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

What does The UDim 1, and UDim2 do?

Asked by 9 years ago

I'm learning how to script a gui that a frame increases as the exp/health/cash goes up?

0
UDim1 does not exist in Lua. That would be like accessing a 1-Dimensional object. An example of this would be a single line. It has no depth, or width, just length. In order to see it, you would need width or depth. Therefore, it isn't in RBX.Lua because it would be pointless to include it, as it could not be used. dyler3 1510 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

UDim2 is a data type that allows you to manipulate GUI sizes and positions. You can use it like this:

GUI.Size = UDim2.new(XScale,XOffset,YScale,YOffset)

Scale

The scale values can be used to make an auto resizing GUI. For example if you had a frame that was 300x300 pixels you and inside that frame you had an image that was set to the size of

UDim2.  new(1,0,1,0)

You could increase the frame to 400x400 pixels and the image would follow.

Offset

Offset is measured in pixels. This will be the same on every screen resolution. Having a frame the same size may cause it to be larger on smaller screen resolutions compared to bigger screen resolutions.

Ad

Answer this question