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

My script w'ont recognize a gui in a PlayerGui ?

Asked by 5 years ago
Edited 5 years ago
game.Players.PlayerAdded:Connect(function(plr)
    local gui = plr.PlayerGui
    plr.CharacterAdded:connect(function(char)
        char:WaitForChild("Humanoid").died:Connect(function()
            print(plr.Name.." / Dead : true")
            game.workspace.DiedSound:Play()
            gui.DeadScreen.TextDead.Visible = true -- the problem is here
        end)
    end)
end)

when i try and i kill my character the output say that DeadScreen is not a valid member of PlayerGui

0
You cannot get PlayerGui from a serverScript, you need a localscript to get PlayerGui aazkao 787 — 5y
0
Put the gui somewhere else and clone it to playergui on the died event ABK2017 406 — 5y

1 answer

Log in to vote
-1
Answered by
markjac -11
5 years ago

try changing gui.DeadScreen.TextDead.Visible = true to

plr.PlayerGui.DeadScreen.TextDead.Visible = true

or

gui:FindFirstChild("DeadScreen").TextDead.Visible = true

Ad

Answer this question