Okay what I'm trying to do is basically like that I'm trying to make when I click an Npc it will make the gui enabled So currently I did Workspace -> ChangeClassNpc -> ClickDetector -> Script ( not local script ) The code is
local CL = script.Parent CL.MouseClick:Connect(function(Plr) local PG = Plr:WaitForChild("PlayerGui") local Guis = PG:WaitForChild("Classpa") Guis.Enabled = true end)
The issue is First Click it opens the gui, then I close but If I will click again or spam the button it won't do anything like the game think the gui is already open
I tried like this tho but it doesn't work ...
local CL = script.Parent CL.MouseClick:Connect(function(Plr) local PG = Plr:WaitForChild("PlayerGui") local Guis = PG:WaitForChild("Classpa") Guis.Enabled = true end)
oh figured it out
local CL = script.Parent CL.MouseClick:Connect(function(Plr) local PG = Plr:WaitForChild("PlayerGui") local Guis = PG:WaitForChild("Classpa") Guis.Enabled = not Guis.Enabled end)