So I have a draggable GUI with a close button, when you press the close button, it tweens the GUI up and off the screen, the problem is though, because the GUI is draggable, I need to get the current position of the GUI on the X axis. But as far as I’m aware, the draggable property of GUIs only works with offset, yet when I try tweening with offset, it tweens off in a random direction.
Is there a way to get the current X axis position and apply it to the tween?
2 Likes
You can:
local XPos = frame.Position.X.Offset --you can also do frame.Size.X.Scale for scale
Then create the tween table. XPos
is a read only property, so you can get the info but to set it you need to create a new UDim2.new()
:
local toTween = {Position = UDim2.new(0, XPos, 0, 0)} --replace the other values as needed
3 Likes
So this should be a solution? I am a bit busy currently so I can’t test it out.
1 Like
Yes that is my intended outcome, thanks for your help!