Size Modifiers and Constraints | Documentation - Roblox Creator Hub (2024)

Alongside basic sizing of UI objects, you can utilize size modifiers to scale an object proportionally or automatically resize it. You can also insert size constraints to control aspect ratio, or set a minimum and maximum size or text size.

Scale

A UIScale object stores a numerical value that multiplies the AbsoluteSize property of the parent GuiObject. For example, if you want an object to be twice as large as it currently is, you can insert a UIScale object with a Scale property of 2.

This modifier is useful for "zooming in" while designing a detailed user interface in Studio, since it proportionally scales the object and all of its children, including any applied appearance modifiers like UIStroke or UICorner. It's also useful to tween the size of an object, for example to slightly increase the size of a button when a player hovers their mouse over it.

Size Modifiers and Constraints | Documentation - Roblox Creator Hub (1)

Automatic Sizing

The AutomaticSize property automatically resizes a parent GuiObject to the size of its descendants. You can use this property in a variety of cases, including:

  • Expanding a GuiObject to fit text that has been localized in many languages.

  • Allowing users to input text within a TextBox, automatically adjusting its size based on the amount of text entered.

  • Automatically adjusting the size of text objects using rich text markup, including font type and size.

You can enable the AutomaticSize property for any GuiObject. By default, it is set to None, but you can change its value to have specific control over which direction(s) the GuiObject resizes to fit its content.

ScrollingFrame uses the AutomaticCanvasSize property instead of AutomaticSize. It behaves the same but resizes the frame's CanvasSize, not its base Size.

To enable automatic sizing:

  1. In the Explorer window, click any GuiObject, such as a Frame, TextBox, or ImageLabel.

  2. In the Properties window, navigate to the AutomaticSize property (AutomaticCanvasSize for ScrollingFrame) and set it to one of the following options:

    • X — Resizes content horizontally.

    • Y — Resizes content vertically.

    • XY — Resizes content both horizontally and vertically.

    Size Modifiers and Constraints | Documentation - Roblox Creator Hub (2)

Once automatic sizing is set, note that other object properties behave as follows:

Similar to the concept of sizing an object, AutomaticSize takes the AnchorPoint property into consideration when resizing content. For example, the following video displays three TextLabels that automatically resize from their anchor point.

  • The top label has an AnchorPoint value of (0, 0.5) which anchors it to the middle of the left side.

  • The middle label has an AnchorPoint value of (0.5, 0.5) which anchors it to the center.

  • The bottom label has an AnchorPoint value of (1, 0.5) which anchors it to the middle of the right side.

Constraints

There are three types of constraints you can use for a user interface object: size, text size, and aspectratio. To use a constraint, you must set it as a child of the GuiObject you want to constrain.

Size

The UISizeConstraint specifies a minimum and maximum size for a GuiObject. This constraint ensures that the GuiObject doesn't become too small or large on different screen sizes.

For example, if you set the MinSize property to (200, 200) and the MaxSize property to (400, 400), the GuiObject cannot scale smaller than 200×200 pixels or larger than 400×400 pixels.

When a UI object is under control of both a layout structure such as UIListLayout and a UISizeConstraint, the constraint will override the layout and control the object's size.

Text Size

The UITextSizeConstraint specifies a minimum and maximum font size for a GuiObject with text, such as a TextLabel, TextButton, or TextBox. This constraint ensures that the text within a GuiObject doesn't become illegible or too large.

If you enable the TextScaled property of the parent GuiObject, the text size scales with the container's size and respects constraints even if the object becomes smaller or larger than the MinTextSize and MaxTextSize values.

For example, the following TextLabel object has a UITextSizeConstraint with a MinTextSize value of 50 and a MaxTextSize value of 80. Even when the TextLabel becomes smaller, the font never becomes smaller than 50 pixels, and when the object becomes large, the font next exceeds 80 pixels.

Do not use MinTextSize property values lower than 9 or the text will be difficult to read for many viewers.

Aspect Ratio

The UIAspectRatioConstraint enforces a width‑to‑height aspect ratio on a GuiObject regardless of its core size, even if that size is set as a percentage of its parent. For example, inserting this constraint as a child of a Frame and setting the constraint's AspectRatio property to 2 (2:1) keeps the frame's width at twice that of its height. Similarly, setting this constraint's AspectRatio property to 0.5 (0.5:1) keeps the frame's width at half that of its height.

Setting this constraint's AspectRatio to the default of 1 (1:1) is a convenient way to prevent non‑proportional scaling/stretching of an ImageLabel with a square image asset, such as an avatar thumbnail.

When a UI object is under control of both a layout structure such as UIListLayout and a UIAspectRatioConstraint, the constraint will override the layout and control the object's size.

Size Modifiers and Constraints | Documentation - Roblox Creator Hub (2024)
Top Articles
Pennsylvania Lottery - News, Events & Media
Mets Midseason Top 30 prospects for 2024 season
What Is Single Sign-on (SSO)? Meaning and How It Works? | Fortinet
jazmen00 x & jazmen00 mega| Discover
Lorton Transfer Station
Cars & Trucks - By Owner near Kissimmee, FL - craigslist
Jazmen Jafar Linkedin
Chase Bank Operating Hours
Boggle Brain Busters Bonus Answers
craigslist: south coast jobs, apartments, for sale, services, community, and events
Notary Ups Hours
30% OFF Jellycat Promo Code - September 2024 (*NEW*)
Routing Number 041203824
Gw2 Legendary Amulet
Becky Hudson Free
Full Range 10 Bar Selection Box
10 Great Things You Might Know Troy McClure From | Topless Robot
Buying risk?
Lonadine
Ts Lillydoll
Mineral Wells Independent School District
Mychart Anmed Health Login
Epguides Strange New Worlds
Walgreens Alma School And Dynamite
Apple Original Films and Skydance Animation’s highly anticipated “Luck” to premiere globally on Apple TV+ on Friday, August 5
Reptile Expo Fayetteville Nc
Raz-Plus Literacy Essentials for PreK-6
Katie Sigmond Hot Pics
Used Safari Condo Alto R1723 For Sale
Apparent assassination attempt | Suspect never had Trump in sight, did not get off shot: Officials
Weathervane Broken Monorail
United E Gift Card
Ripsi Terzian Instagram
Kattis-Solutions
Gideon Nicole Riddley Read Online Free
Save on Games, Flamingo, Toys Games & Novelties
A Man Called Otto Showtimes Near Carolina Mall Cinema
Drabcoplex Fishing Lure
Spinning Gold Showtimes Near Emagine Birch Run
Hermann Memorial Urgent Care Near Me
Clark County Ky Busted Newspaper
Atlanta Musicians Craigslist
Indiana Jones 5 Showtimes Near Cinemark Stroud Mall And Xd
11301 Lakeline Blvd Parkline Plaza Ctr Ste 150
Thelemagick Library - The New Comment to Liber AL vel Legis
Easy Pigs in a Blanket Recipe - Emmandi's Kitchen
Craigslist Pet Phoenix
La Qua Brothers Funeral Home
Tropical Smoothie Address
R Detroit Lions
Round Yellow Adderall
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated:

Views: 5786

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.