Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI when clicked works, when clicked again it doesn't?

Asked by 5 years ago

Hello, whenever I click my GUI to show the menu it works by showing the main menu. When I click the GUI again however, everything vanishes and I am unable to click the GUI again. I am unaware of what is causing such problem, as I am very new to scripting. In fact, this isn't my script. Please be aware.

Thanks, Azure.

01local open = false
02script.Parent.MouseButton1Click:Connect(function()
03    if not open then
04        open = true
05        script.Parent.Parent.Parent.Frame.Visible = true
06script.Parent.Parent.Parent.settings.Visible=false
07    script.Parent.Parent.Parent.shop.Visible=false
08    script.Parent.Parent.Parent.help=false
09else
10        script.Parent.Parent.Parent.Frame.Visible = false
11    script.Parent.Parent.Parent.settings.Visible=false
12    script.Parent.Parent.Parent.shop.Visible=false
13    script.Parent.Parent.Parent.help=false
14        open = false
15    end
16end)

1 answer

Log in to vote
0
Answered by
Hydrogyn 155
5 years ago

this should work:

01local open = false
02 
03script.Parent.MouseButton1Click:Connect(function() -- fire event when plr clicks
04    if not open then -- is the value false?
05        open = true -- set value to true
06        script.Parent.Parent.Parent.Frame.Visible = true  -- set visible to true
07    script.Parent.Parent.Parent.settings.Visible= true
08    script.Parent.Parent.Parent.shop.Visible=true
09    script.Parent.Parent.Parent.help.Visible =true
10else
11        open = false -- set value to false
12    script.Parent.Parent.Parent.Frame.Visible = false -- set visible to false
13        script.Parent.Parent.Parent.settings.Visible=false
14    script.Parent.Parent.Parent.shop.Visible=false
15        script.Parent.Parent.Parent.help.Visible=false
16    end
17end)
Ad

Answer this question