I basically want my gui to open and close. But, I also want it to check if another gui's button is visible, meaning it's open as well. If it is open, it closes that and then opens the gui. But, that doesn't work so well. I get no errors, it just doesn't open.
function clicked()
local playing = script.Parent.Parent.Parent.Parent.playing
local debounce = false
if script.Parent.Parent.Shop.Visible == true and debounce == false then
debounce = true
script.Parent.Parent.Shop.Visible = false
script.Parent.Parent.Shop.Active = false
wait(1)
elseif script.Parent.Parent.Shop.Visible == false and debounce == false then
if script.Parent.Parent.Parent.GameInfo.Shop.Visible == true then
debounce = true
script.Parent.Parent.Shop.Visible = true
script.Parent.Parent.Shop.Active = true
script.Parent.Parent.Parent.GameInfo.Shop.Visible = false
script.Parent.Parent.Parent.GameInfo.Shop.Active = false
wait(1)
elseif script.Parent.Parent.Parent.GameInfo.Shop.Visible == true then
debounce = true
script.Parent.Parent.Shop.Visible = true
script.Parent.Parent.Shop.Active = true
wait(1)
end
end
wait()
end
script.Parent.MouseButton1Down:connect(clicked)
Help?

4 comments
just a coding tip, you dont need things like "Visible == true" as an if statment will run if true anyway. use "if Visible then" its a lot faster
Do you have an error in the output? Because that would really help.
Then I am stumped.
I have an idea, perhaps you can us onClicked? on the top and number 27 should be MouseButton1Click:connect(onClicked) a