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

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

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

2 comments

0

You cannot get PlayerGui from a serverScript, you need a localscript to get PlayerGui

0

Put the gui somewhere else and clone it to playergui on the died event

1 answer

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

plr.PlayerGui.DeadScreen.TextDead.Visible = true

or

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

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