Typically, you want to set the AnchorPoint to the exact center (.5, .5) when the GUI is going to be at the center of the screen. Then, the position would also use 0.5 for the scaling, e.g. UDim2.new(.5, 0, .5, 0). In your case, when the GUI needs to disappear by going straight down, the AnchorPoint should be .5, 0 and the position to tween to should be UDim2.new(.5, 0, 1, 0).
I assume you want the Frame instance to slide down the screen until it disappears, if so the above will work. Remember to use task.wait() instead of wait() as it’s more accurate.
This sounds like you want it to go down with the X value not changing. You’d just need to set the x values in the tween to be the current position values of the frame instead of in the middle of the screen.
local button = script.Parent
local frame = script:FindFirstAncestorWhichIsA("Frame")
local framePos = nil
frame:GetPropertyChangedSignal("Position"):Connect(function()
button.MouseButton1Click:Connect(function()
frame:TweenPosition(UDim2.new(frame.Position.X.Scale + frame.Size.X.Scale/2, 0, 1, 0), "Out", "Quad", .3)
task.wait(.3)
frame.Visible = false
end)
end)
I wasn’t aware that it was draggable, you can do the above to dynamically change the tween, according to its current position and size, which is created and then played upon the button being clicked.