I want to make it so when a button is pressed GUI goes up from the bottom of the screen to around the middle and when the button is pressed again the GUI goes back down.
If I make it so that the script waits 10 seconds and then moves the GUI it works however if I link it up to the button being pressed it doesn’t work. The button can be pressed because I have other scripts that work when it’s pressed. The script is a Local Script but even with it being a normal script it doesn’t seem to work.
I have looked on the Developer Forum and I tried their scripts but it doesn’t work. I feel the solution is simple and I’m just missing something minor. The script is under the button.
This is the script I’m using:
local Gui = game.StarterGui.RebirthGui.Frame
local Toggle = script.Parent
local on = false
Toggle.MouseButton1Click:Connect(function()
if on == false then
Gui:TweenPosition(
UDim2.new(0.5, 0, 0.5, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
0.5
)
on = true
elseif on == true then
Gui:TweenPosition(
UDim2.new(0.5, 0, 1.5, 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Sine,
0.5
)
on = false
end
end)