UI Constraints (Aspect Ratios, Size Modifiers, etc) - Roblox GUI Tutorial #15 (2025) — Transcript
Full transcript
- 0:00Welcome back to my Roblox GUI tutorial
- 0:02series. My name is Balv and in this
- 0:03episode we'll be discussing about UI
- 0:06constraints and size modifiers. So, when
- 0:09we've been working with GUI elements
- 0:11inside of our Roblox games, we've had to
- 0:14maintain the size of these GUI elements
- 0:17to make them look good inside of our
- 0:19Roblox games. Regardless of how big or
- 0:22how small our screen is, whether we're
- 0:24playing on a phone or whether we're
- 0:25playing on a TV, it doesn't matter. But
- 0:28what if that's not enough? What if we
- 0:29want to have more control over our size
- 0:33modifiers to be able to scale our
- 0:36objects as we want them to or to be able
- 0:38to automatically rescale them or even
- 0:41add size constraints to make sure that
- 0:43GUI elements don't become too big or
- 0:46don't become too small. That's the
- 0:48purpose of some of these instances that
- 0:49Roblox has provided to us to make sure
- 0:52that we can maintain the size of our GUI
- 0:55elements. And that's what I'm going to
- 0:57be showing you how to do inside of this
- 0:59tutorial with the instances that Roblox
- 1:01has provided to us. So, what I'm going
- 1:03to do is go to starter GUI and I'm going
- 1:05to insert a screen GUI. And I'm going to
- 1:08insert a frame and move it to the center
- 1:11just like this. So, the first element
- 1:14that I'm going to show is called a UI
- 1:16scale. So, I'm going to hit the plus
- 1:18sign on the frame and search up a UI
- 1:20scale just like this. And this only has
- 1:22one property which is called scale. Now
- 1:24the basic idea behind UI scale is that
- 1:27it takes the GUI element and all of its
- 1:30descendants and it scales it
- 1:33proportionally so that it maintains the
- 1:36size while also scaling it upward or
- 1:39downward. So if I were to change the
- 1:41scale of let's say from 1 to two then
- 1:43what it's going to do is it's going to
- 1:45double the size of the GUI element. And
- 1:48if I were to do it with three then it's
- 1:50going to keep doing that. We can even do
- 1:52it the opposite way by reducing the size
- 1:54of it in half. And what we can do with
- 1:57this actually is change the anchor
- 1:59points to 0.5 and 0.5 and then move it
- 2:02to the center just like this. So that
- 2:05when we change the UI scale, it's going
- 2:07to change the scale from the center of
- 2:09the frame rather than the top left
- 2:11corner. So this is a pretty neat feature
- 2:13with UI scale. And one use case that I
- 2:16can see with this is if you were to use
- 2:18tween service to smoothly animate the
- 2:21size of a frame with its descendants.
- 2:23And I think that's a really good use
- 2:25case of using it. Now the next object I
- 2:27want to show is called a UI size
- 2:30constraint. So what I'm going to do is
- 2:32delete this UI scale and I'm going to
- 2:35hit the plus sign and I'm going to
- 2:36insert a text label. So as you can see
- 2:38with this text label, it's currently
- 2:40bigger than the actual frame itself. So,
- 2:42it's clipping outside of this GUI
- 2:45element. But what if we wanted a way to
- 2:47automatically resize the frame to make
- 2:51it so that it fits with all the GUI
- 2:53elements that are contained inside of
- 2:54it? We can do that by using a property
- 2:56called automatic size. And by default,
- 2:58it's set to none. But if we were to drop
- 3:00this down, then we have three options
- 3:02here to choose which axis we want to
- 3:04affect the size for. So, what we can do
- 3:06is select X. So, as you can see, the
- 3:09frames size automatically adjusted to
- 3:12fit the size of the text label. And if I
- 3:14were to, let's say, insert a grid
- 3:16layout. And let's say really quickly I
- 3:18wanted to change the background color to
- 3:20something different. If I were to
- 3:21quickly duplicate all these text labels,
- 3:23then as you can see, the frame is
- 3:26automatically adjusting its size to
- 3:28reflect these text labels. But as of
- 3:30right now, I have it set to X only. So,
- 3:33if we were to set it to X and Y, then as
- 3:35you can see, the frame is now adjusting
- 3:38its size to reflect on all of these um
- 3:40text labels, which I think is a pretty
- 3:42neat feature. So, now there's two more
- 3:44instances that I want to show you called
- 3:45UI size constraint and UI text size
- 3:48constraint. So, I'm just going to take
- 3:50this frame and make it invisible. And
- 3:52I'm going to insert a text label and
- 3:54move it to the center. So, the first
- 3:57object is a UI size constraint. And
- 3:59basically what this does is we can
- 4:01determine the maximum size and the
- 4:03minimum size of a gy element so that it
- 4:06doesn't become too big or too small. So
- 4:08if I were to let's say change the max
- 4:10size to something like uh 100 and 100
- 4:14for y as well then it can't be any
- 4:17bigger than 100 pixels and 100 pixels on
- 4:21the x and y direction. So for our text
- 4:24label, if we were to, let's say, change
- 4:26the size of this to 500 and 500, then
- 4:30it's not going to get any bigger than
- 4:33100 and 100, which is what we initially
- 4:35set. So if we were to, let's say, make
- 4:37this 50 instead, then it actually is
- 4:40going to become smaller because it does
- 4:42fit within the range of our max size and
- 4:45minize. So that's what UI size
- 4:48constraint does. And the next thing I
- 4:49want to show is called a UI text size
- 4:52constraint. So a UI text size constraint
- 4:56is basically the same thing as a UI size
- 4:58constraint except instead of for a GUI
- 5:01element, it's for a text within a text
- 5:04label. So um I'm just going to change
- 5:07the size of this to 250. And for this
- 5:12text size, we have a max text size and a
- 5:14min size. So if I were to change this to
- 5:16let's say 40 and I were to change the
- 5:18min text size to 30, then we can only
- 5:21fit the text within the bounds of these
- 5:24two properties here. So if I were to
- 5:27let's say go down here and turn on text
- 5:29scaled, then what's going to happen is
- 5:31if I scale this, the text label is not
- 5:34going to change size because it's past
- 5:3640. But if we were to scale it down,
- 5:38then it's going to go down to 30, but
- 5:40then it's not going to go anything lower
- 5:42than 30. And so that's what a UI text
- 5:45size constraint does. And uh there can
- 5:47definitely be some practical use cases
- 5:48for using this. Okay. Now the last
- 5:51object that I want to show you is called
- 5:54a UI aspect ratio constraint. And
- 5:56basically what this does is it maintains
- 6:00a width to height aspect ratio of a GUI
- 6:03object regardless of the size of that
- 6:07element. So this is really useful if
- 6:09let's say we have a image label and we
- 6:12don't want to stretch out the image
- 6:14label to make it look really weird and
- 6:17non-proportional. We can use a aspect
- 6:20ratio constraint to maintain the size of
- 6:23it to make it look good. So if I were to
- 6:25show you an example of this, I'm just
- 6:26going to quickly disable the text label.
- 6:29I'm going to insert a image label just
- 6:32like this. And we need to take an image
- 6:35from the toolbox. So, I'm just going to
- 6:36go to view. I'm going to open up the
- 6:38toolbox, and I'm just going to pick a
- 6:40random uh decal from here. So, I'm just
- 6:43going to rightclick, copy asset ID, and
- 6:45then change the image of this to um our
- 6:48image. So, by default, we can scale the
- 6:51size of this to make it look stretched
- 6:53out like this if we want. But if we want
- 6:55to maintain its aspect ratio, then what
- 6:58we can do is hit the plus sign, and
- 6:59we're going to insert a UI aspect ratio
- 7:02just like this. And now if we were to
- 7:04change the scale of this, we can see
- 7:06that it's locked to be diagonal because
- 7:11we now added a aspect ratio constraint
- 7:13to it. So we can't stretch it out or
- 7:16make it non-proportional. We can only
- 7:18have it within this width to height
- 7:20aspect ratio when we're using these GUI
- 7:22elements. And I think this is a really
- 7:24practical use case of using this. So
- 7:26we've just went over some examples of
- 7:28using these size constraint modifiers.
- 7:31And I hope you found this video to be
- 7:32helpful when it comes to being
- 7:34introduced with these um size constraint
- 7:36modifiers that you can use for your own
- 7:38Roblox games. So for today's learning
- 7:41objective, I want you to recreate this
- 7:43HUD panel on the left side here. Uh so
- 7:45we have things like our health bar and a
- 7:48coins counter on the bottom of it. And
- 7:51we also have an image label to show the
- 7:53the health and also the currency. So
- 7:56once you have this down, what I want you
- 7:58to do is I want you to use these objects
- 8:01that I taught you to maintain an aspect
- 8:04ratio for this panel to make sure that
- 8:07when we size it. So if I were to rescale
- 8:11this frame, then it's going to maintain
- 8:14the size of the bar and also the image
- 8:18labels on the left of these bars as
- 8:20well. And that's the important thing
- 8:22about this. It's to be able to maintain
- 8:24the size of these GUI elements that are
- 8:26contained within this frame using the
- 8:28things that I've taught you with things
- 8:29like aspect ratios, text size
- 8:32constraints, UI scales, and things like
- 8:34that. Cuz let me show you what happens
- 8:36if I were to get rid of these size
- 8:39constraints. So, if I were to get rid of
- 8:41these and if I were to now rescale the
- 8:44frame, you can see that the image labels
- 8:46are being stretched out to make it look
- 8:48unnatural and we don't have a way to
- 8:51maintain the aspect ratio or the text
- 8:53size of these elements. So, that's what
- 8:56I want you to try and do for this
- 8:57learning objective. And as an added
- 9:00challenge, if you do manage to do this,
- 9:01I want you to use UI scale to have this
- 9:05toggle HUD button. So when you press it,
- 9:07then it's going to use tween service to
- 9:10basically just hide it. And if we were
- 9:12to click it again, then it's going to
- 9:13pull back the HUD panel just like this.
- 9:16So that is what I want you to do for
- 9:18today's learning objective. And if you
- 9:20have something that's similar to this,
- 9:22then I think you're on the right track
- 9:23to becoming a better Roblox developer by
- 9:26being able to maintain your aspect
- 9:28ratios for your GUI elements. So that's
- 9:30pretty much going to be it for this
- 9:31episode. Big shout outs to my Patreon
- 9:33members for the support. And with that
- 9:35being said, I hope you enjoyed this
- 9:37video and I will see you in the next
- 9:39one.
About this transcript
This page contains the full transcript of UI Constraints (Aspect Ratios, Size Modifiers, etc) - Roblox GUI Tutorial #15 (2025) by BrawlDev, generated from the public captions YouTube serves with the video. The transcript has 1,899 words across 244 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.