Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make gui's compress and stretch ALL THE TIME when resolution changes?

Asked by
DemGame 271 Moderation Voter
3 years ago

I have a game that has a lot of gui's, but they become off-centered and no longer have edges that match up the way I want them to anymore when the resolution changes. Is there a way to make gui's become smaller in all directions as the resolution becomes smaller to prevent this?

1
You mean UDim2 Scale properties? UDim2.new(xScale,xOffset,yScale,yOffset). The scale properties will be affected by the size of the screen resolution(if parented to a ScreenGui) or the size of the guiobject it is parented to (frames,textbuttons). If you set a button position to UDim2.new(0.5,0,0.5,0) for example, the button will be placed at .5 the size of the screen, which is the center. Dfzoz 489 — 3y
0
Does that also affect the size of the Gui? DemGame 271 — 3y
0
Yes Dfzoz 489 — 3y
0
Great question! 2Loos 168 — 3y

1 answer

Log in to vote
1
Answered by
2Loos 168
3 years ago

When creating GUI, you will notice the default size is usually something like {0,100},{0,100} for frames and {0, 200},{0, 50} for TextLabel and TextBox. The first and third digits are called Scale. The second and fourth digits are called Offset. You should always use Scale to avoid GUIs from going off-screen. Scale will make sure the GUI fit on the screen.

Example 1: If you're trying to set a GUI to cover the full screen, the UDim2 value can be set to {1,0},{1,0}

Example 2: If you're trying to set a GUI to the center of the screen, we will use AnchorPoint. Set the AnchorPoint value to 0.5,0.5. This will move the GUI to the center of the screen. Now you can use the Scale values to make the GUI however large you want.

0
Thanks. I got a plugin that converted all my offset values to scale values. DemGame 271 — 3y
Ad

Answer this question