So i’ve managed to tween a simple GUI from outside the screen , inside.
But now i am stuck on how to make the GUI go back if i click the same button again. I’ve searched on youtube and devforum and could not find anything (or maybe i didn’t knew the right terms of searching)
Anyway here is the script i did and also here is the placement in-game
Script :
local MenuButton = script.Parent.MenuButton.Button
local Menu = script.Parent.Menu
Menu.Position = UDim2.new(1.1,0,0.902,0) --Start Position
MenuButton.MouseButton1Click:Connect(function(OpenMenu)
--Open Menu
Menu:TweenPosition(
UDim2.new(0.789,0,0.902,0), --End Position
"InOut", --Easing Direction (where the tweeening will happen)
"Quart", --Easing Style
0.1, --Time in seconds
false, --Override other tweens
nil, --Callback (function)
false --Return
)
end)
MenuButton.MouseButton1Click:Connect(function(CloseMenu)
--Close Menu
UDim2.new(-.789,0,0.902,0) --Start Position
Menu:TweenPosition(
UDim2.new(1.1,0,0.902,0), --End Position
"InOut", --Easing Direction
"Quart", --Easing Style
0.1, --Time in seconds
false, --Override
nil, --Callback
false --Return
)
end)
Placement :
This sounds easy to solve for most of the scripters here but keep in mind that i am new to scripting so please tell me if i did something wrong or if there are easier ways to solve this.
Thank you for helping.