A UDim2, which is basically two UDims (Universal Dimensions) being represented within the same object, is a Lua object which stores information about the size and position of GUI elements. The difference between a UDim and UDim2 is that a UDim2 represents a two dimensional plane with x and y coordinates while a UDim only accounts for one coordinate.

The constructor takes parameters in the order: xscale, xoffset, yscale, yoffset.


X.Scale and Y.Scale set the size or position of an element proportionally to the size of its parent. A value of 1 will set the child to the same size or position as its parent on the specified axis, and 0 will make it have a size 0% of its parent, and have a position 0% of its parent on the specified axis.

X.Offset and Y.Offset set the size or position of an element in pixels. This number is added to the Scale parameters, after their size has been calculated: these values are offsets.

The size of a GUI is calculated using the formula:

Size = Scale*Parent.AbsoluteSize + Offset

The position of a GUI is calculated using the formula:

Position = Parent.AbsolutePosition + Scale*Parent.AbsoluteSize + Offset


local frame ="Frame")
frame.Position =, -50, 1, -100)
frame.Size =, 100, 0, 100)
frame.Parent = GUI

This creates a 100×100 pixel rectangle, centered at the bottom of the screen.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.