Hi! Recently I started making a GUI for people to buy and equip items in my game, and I need some help. I’m a beginner at scripting and haven’t experienced much.
Basically my goal is to make the shop gui come on screen when you press it, then go back when you press it again. Here is what I managed to do: https://gyazo.com/6362c5826116c5662dbde88fcd9759e7
Basically, it can tween to go on screen, but I don’t know how to make it go off screen with a tween if you click the same button. Here is the script for the whole GUI:
local Shop = script.Parent.Shop
local ItemsToggle = script.Parent.ItemsToggle
local ItemsMinimize = ItemsToggle.ItemsMinimize
ItemsToggle.MouseButton1Up:Connect(function()
Shop:TweenPosition(
UDim2.new(0.224,0 ,0.075, 0), --EndPosition
"Out", --Easingirection
"Quad", --EasingStyle
0.6, --Time
true, --Override
nil --Function
)
end)
ItemsMinimize.MouseEnter:Connect(function()
ItemsToggle:TweenPosition(
UDim2.new(0, 0,0.452, 0), --EndPosition
"Out", --Easingirection
"Quad", --EasingStyle
0.6, --Time
true, --Override
nil --Function
)
end)
ItemsToggle.MouseLeave:Connect(function()
ItemsToggle:TweenPosition(
UDim2.new(-0.125, 0,0.452, 0), --EndPosition
"Out", --Easingirection
"Quad", --EasingStyle
0.6, --Time
true, --Override
nil --Function
)
end)
How can I make it so I can close the GUI by pressing the same button? I tried using an if statement but it gave me errors, and I don’t think I can use not
because I don’t want to change only the Visible property. Any help is very appreciated! Oh, and this is my first devforum post.