PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Repositioning a GUI Element

Repositioning a GUI Element

Jun 14 2019, 4:47 PM PST

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.

Tags:
  • gui
  • script
  • coding