I am trying to get a button (script.Parent) to make a GUI appear or disappear when you click on it. Why is it not working?
local button = script.Parent
local gui = game.Lighting.ScreenGui
function onClick(p)
if (gui.Parent == p.PlayerGui) then
gui.Parent = game.Lighting
end
if (gui.Parent == game.Lighting) then
gui.Parent = p.PlayerGui
end
end
button.MouseButton1Click(onClick)
Thanks!

3 comments
this will open the GUI, but not close it.
I edited it, try the new one. It should work.
Thanks! It works now.