Data type
UDim
Represents a one-dimensional value with two components, a relative scale and an absolute offset.
About UDim
The UDim data type represents a one-dimensional value with two
components: a relative scale and an absolute offset in logical pixels. At
evaluation time, the engine computes the final pixel value as
Scale * referenceMeasurement + Offset, where the reference measurement is
typically the size of a parent GuiObject along the corresponding axis.
UDim values appear individually in properties such as
UICorner.CornerRadius, UIPadding.PaddingTop, and
UIStroke.Thickness, or paired as a UDim2 for
two-dimensional sizing and positioning.
-- 50% of the parent plus 10 extra logical pixels
local dimension = UDim.new(0.5, 10)
Constructors 1
UDim.new
(Scale: number, Offset: number)Returns aUDimfrom the given components.
Properties 2
Scale
: numberThe relative scale component of theUDim.The relative scale component of the
UDim, expressed as a fraction of a reference measurement (typically the corresponding axis of a parentGuiObject). A value of1represents the full reference measurement,0.5represents half, and0means the scale contributes nothing to the resolved pixel value. Defaults to0when not specified in the constructor. This property is read-only.Offset
: numberThe absolute offset component of theUDim.The absolute offset component of the
UDimin pixels. This value is added to the resolved scale portion (Scale * referenceMeasurement) to produce the final pixel measurement. The offset is stored as an integer. Defaults to0when not specified in the constructor. This property is read-only.
Math operations
- UDim + UDim → UDim
- UDim - UDim → UDim
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.