Hey, sorry for the too many questions today! I fixed the open button, but once the shop gui was opened, and the player clicks one more time on the open button, I want it to close the shop gui. Is this possible? If yes, with what script?
Yes, use a variable like GuiOnScreen
for example:
local Gui = script.Parent
local Button = script.Parent.Button
local GuiOnScreen = false
Button.Mouse1Click:Connect(function()
if GuiOnScreen == false then
GuiOnScreen = true
Gui.Visible = true
elseif GuiOnScreen == true then
GuiOnScreen = false
Gui.Visible = false
end
end)
So the if statement checks if the Gui is visible or not and if it isn’t then when you click it it will become visible and GuiOnScreen will be true because it IS on screen and you can see it, but when you click it again and it is already on screen it will become invisible because of the elseif statement.
1 Like
it is very simple
Button.activated:connect(function()
if Gui.Visible == true then
Gui.Visible = false
elseif Gui.Visible == false then
Gui.Visible = true
end
end)
you do not need the variable