Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why the Gui Enabled doesn't change?

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)


1 answer

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)

2 comments

0

Man why does no one read it...

0

I'm trying to make when I click an Npc it will make the gui enabled not to close the gui........................

This discussion is preserved as it was. New answers, comments, and votes are closed.