Do you want the frame to get like overridden (Say it's half way out and you want it to come back in at that moment), or do you want to have it wait until the frame is completely out? Either way, there is a answer to both of these.
Override;
Time = 1
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Text == "SHOP" then
wait(1/30)
script.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Quad", Time, true)
wait(0.1)
script.Parent.Text = "CLOSE"
elseif script.Parent.Text == "CLOSE" then
wait(1/30)
script.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Quad", Time, true)
wait(0.1)
script.Parent.Text = "SHOP"
end
end)
There is an argument for overriding a Guis destination, all you had to do was add , true inside the methods. This argument will allow you to send a Gui out one way, and if you change your mind, send it back.
Wait until it reaches its destination.
Time = 1
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Text == "SHOP" then
wait(1/30)
script.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Quad", Time)
repeat wait() until script.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Quad", Time)
script.Parent.Text = "CLOSE"
elseif script.Parent.Text == "CLOSE" then
wait(1/30)
script.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Quad", Time)
repeat wait() until script.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Quad", Time)
script.Parent.Text = "SHOP"
end
end)
Now, the Tween methods return a bool telling if the method is done or not, all you have to do is add a loop wait until the method is finished.
1 comment
If I keep spam clicking it, after it goes up and down, it goes up and down again.