bin = script.Parent function Clicked() bin.Parent.Visible = false script.Parent.Parent.Visible = false local Main = script.Parent.Parent.Parent:findFirstChild("Main") Main.Visible = true end bin.MouseButton1Down:connect(Clicked)
Any suggestions?
Try using it as a Local script. They are much easier to use when doing stuff with UI. Also, is this a StarterGUI that pops up when you join?
bin = script.Parent function Clicked() bin.Parent.Visible = false script.Parent.Parent.Visible = false --^ Why? bin.Parent is the same as script.Parent.Parent! local Main = script.Parent.Parent.Parent:FindFirstChild("Main") --^ If the 'Main' is the same as script.Parent.Parent then it's the next line just makes the bin.Parent.Parent AKA 'Main' visible again. Main.Visible = true --^ Remove this, if script.Parent.Parent is 'Main'. end bin.MouseButton1Down:connect(Clicked)
I'd rather do it like this;
local Visible = false script.Parent:MouseButton1Down:connect(function() if Visible == true then Visible = false script.Parent.Parent.Visible = false elseif Visible == false then Visible = true script.Parent.Parent.Visible = true end)
The local 'Visible' is because you could use some later on checks to see if the GUI is actually closed or opened.