The UDim data type represents the position and size of a GUI element within one dimension. UDim is composed of a relative scale (as per parent) and an absolute offset (as per unit). UDim is constructed from two number values. Two UDim values are used to construct a UDim2 value.
Scale is a number between 0.0 and 1.0 that is a percentage of the parent object's size. For example, if the parent object is 50 pixels wide, a UDim scale of 0.5 would be 25 pixels wide. 0.5 makes the size cover 50% of its parent, same as 0.38 is going to cover 38%, 0.85 is going to cover 85%, and so on.
Offset is a specified integer. This is a non changing value that is factored into the UDim calculation.
The final result is a combination of Scale and Offset: Scale * Parent.AbsoluteSize + Offset.
Referenced by[]
- (position)
- (endPosition)
- (endSize)
- (endSize, endPosition)
- (initialPosition)
- (position, size)
- (position)
- (removed)
- (removed)
- (removed)
- (removed)
- (removed)
- (removed)
External links[]
- UDim on the Roblox Creator Documentation
Basic Lua types | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Roblox types |
| ||||||||||||||||||||||||||
API reference only |