Why use UIPadding?
UIPadding applies interior spacing without manually shifting every child. It is useful for readable panels and lists, especially when the number of children changes.
Try it in Roblox Studio
Create StarterGui > PracticeGui (ScreenGui) > Panel (Frame), then put this LocalScript inside Panel. Add a child label in Studio to see the inset.
Syntax
padding.PaddingLeft = UDim.new(0, 12)Examples
UIPadding
Inset all four sides of a panel.
local panel = script.Parent
assert(panel:IsA("Frame"))
local padding = Instance.new("UIPadding")
padding.PaddingLeft = UDim.new(0, 12)
padding.PaddingRight = UDim.new(0, 12)
padding.PaddingTop = UDim.new(0, 8)
padding.PaddingBottom = UDim.new(0, 8)
padding.Parent = panel- Each Padding property is a UDim: scale plus pixel offset.
- The example uses pixel offsets to provide consistent spacing at the panel edge.
- UIPadding affects the layout area of the parent’s children; it does not enlarge the Frame itself.
Best practices
- Use padding with layouts for consistent spacing.
- Check that small screens still leave room for content.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation