Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why the Gui Enabled doesn't change?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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)
0
Man why does no one read it... AmirGavron -2 — 3y
0
I'm trying to make when I click an Npc it will make the gui enabled not to close the gui........................ AmirGavron -2 — 3y
Ad

Answer this question