Repositioning a GUI Element
Repositioning a GUI Element
Problem
You want to position a GUI 50 pixels down and 50 pixels to the right.
Solution
Use the UDim2|UDim2.new()
method and set the offsets.
local frame = Instance.new("Frame") frame.Position = UDim2.new(0, 50, 0, 50)
Discussion
We use UDim2
with 50
for both the xOffset
and yOffset
components. This will move the GUI down 50 pixels and right 50 pixels from the upper-left corner of the screen.
It's important to note that this code example will not produce any visible result; this is just an introduction to positioning the GUI.