So basically my gui is supposed to go back to the original position, however it stops before making it to the position! Heres a video:
As you can see the gui doesnt make it back fully to the original position.
Any help is much appreciated!
So basically my gui is supposed to go back to the original position, however it stops before making it to the position! Heres a video:
As you can see the gui doesnt make it back fully to the original position.
Any help is much appreciated!
Can you show your script for the gui positioning/tweening? We can’t really help without knowing how it works in the first place…
Sure!
local gui = script.Parent.Frame
local button = script.Parent.Frame.Button
gui.MouseEnter:Connect(function()
wait(1)
gui:TweenPosition(UDim2.new(0, 0, 0, 0),
"In", -- Easing Direction
"Linear", -- Easing Style
0.5 -- Time (Seconds)
)
button.Text = "<"
wait (1)
end)
gui.MouseLeave:Connect(function()
wait(1)
gui:TweenPosition(UDim2.new(0, -280, 0, 0),
"Out", -- Easing Direction
"Linear", -- Easing Style
0.5 -- Time (Seconds)
)
button.Text = ">"
wait (1)
end)
Hmm, instead of just copying the position from properties manually, it’s better to do it with a script, so it’s much more accurate and doesn’t require handwork:
local OriginalPos = YourGui.Position
Make sure this is in the start of the script, or before the gui’s position is changed. Simply, it’ll save the gui’s position the the variable “OriginalPos”, you can test by changing the position and printing OriginalPos (print(OriginalPos
), it’ll return your position of the gui at the time whenever you assigned the variable.
Okay ill try that! Thank you for the advice
No problem, let me know how it goes
How exactly would I type originalpos into the tween?
gui:TweenPosition(OriginalPos,
"Out", -- Easing Direction
"Linear", -- Easing Style
0.5 -- Time (Seconds)
)
Just calling OriginalPos
will return the Vector3 of the .Position you typed in the variable, like @itsLevande said
or you can just tween AnchorPoint from 0, 0 to 1, 0