How do I get a guis position?

I’m really confused. why doesn’t this work?
Position.Value = player.PlayerGui:WaitForChild(“ScreenGui”).TextLabel.Position.X

Do

local textlabel = --set the variable
textlabel.Position = Udim2.new(new position)
1 Like

I’m trying to store it’s position though, what you’re doing is changing it.

GUI’s have a different type of position property from your part. They have a .Position property with a .X and .Y value in them, and the X and Y both have a Scale and Offset property in them.

The position for a GUI is stored as a Udim2 value, which takes 4 numbers:

Udim2.new(X.Scale, X.Offset, Y.Scale, Y.Offset)

Hopefully you can see now how this is a little different from the normal position property.

1 Like

If you’re trying to store the entire position, just do TextLabel.Position

If you want to store the X position, you would need to store either the Offset or Scale of the X position. If you’re using both the Scale and Offset, you would need to save both.

1 Like

I think that

local pos = plr.PlayerGui.ScreenGui.TextLabel.Position
print(pos)

would just work, or if that doesn’t work then

local pos=
{plr.PlayerGui.ScreenGui.TextLabel.Position}
print(pos[1])