Yuari
Documentation

UDim

Roblox-style scale and offset pair.

Syntax

UDim.new(scale?: number, offset?: number) -> UDim
UDim.fromScale(scale?: number) -> UDim
UDim.fromOffset(offset?: number) -> UDim

Parameters

ParameterTypeDescription
scalenumberScale component, default 0.
offsetnumberOffset component in pixels, default 0.

Returns

TypeDescription
UDimThe constructed value.

Description

UDim.fromScale sets the offset to zero and UDim.fromOffset sets the scale to zero.

The userdata exposes read-only Scale and Offset numbers. typeof(udim) reports UDim and == compares both components exactly.

Example

local u = UDim.new(0.5, 10)
print(u.Scale, u.Offset, typeof(u))
print(UDim.fromOffset(24).Offset)

Notes

  • UDim2 constructors still take raw numbers; building a UDim2 from a UDim is not implemented.
  • Arithmetic operators are not implemented.