Keep Gui Position When Re-Parented?

I have a gui that I drag around and when the player lets go, it re-parents itself to another gui. But when you let go, the position gets messed up because the gui it gets parented to is a different size than the one it was parented to before. Here’s a video of it happening:

Use absolute position

Frame.Position = Udim2.new(0,Frame.AbsolutePositon.X,0,Frame.AbsolutePositon.Y)
1 Like

This is the part of my script that changes the position:

local delta = input.Position - dragStart
blockClone.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)

Do you know how I could change this?

just add it at the start of the script, the scale is the problem, Scale position is dependent on the Parent size and position

So change scale to absoluteposition?

yes convert the whole position as i wrote above

It said AbsolutePositon is not a valid member of TextButton "Players.Wildcutepenguin.PlayerGui.BlocksGui.Blocks.TextButton".

i misspelled position
i missed an i after t

1 Like

It doesn’t throw an error now but it doesn’t move anymore.

I think it might be because you removed delta.

Here is a replacement for the movement, which should work

how do I call the Initialize function?

check the description there is a dev forum post

It’s says no description available, could you edit it or send me the link here?

Nvm, I found it.

It does the exact same thing I have right now but without the current modifications I have made. Does anyone else know how to achieve what I’m wanting here?

I have found the solution: