Oh yeah, there's that too.
Scripts for GUIs need to be part of that GUI for it to work.
Put the script in the GUI, then reference script.Parent
With all necessary changes, your script looks like this:
---
local gui = script.Parent
function onClicked(playerWhoClicked)
if gui.Visible== false then
gui.Visible= true
else gui.Visible= false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|