This code below is from a script in Workspace and it doesn't seem to work if a player resets.
game.Players.PlayerAdded:connect(function(p)
wait(1)
p.Character.Humanoid.Died:connect(function(c)
print("dead")
dead = true
end)
end)
This code below is from a script in Workspace and it doesn't seem to work if a player resets.
game.Players.PlayerAdded:connect(function(p)
wait(1)
p.Character.Humanoid.Died:connect(function(c)
print("dead")
dead = true
end)
end)
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Died
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
print(player.Name .. " has died!")
-- by setting dead to true you do it for all players i would not reccomend.
end)
end)
end)
It has to wait for the new character, since the player's appearence regenerates every time it dies.
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
is that code running from a server script?
Yes.
Humanoid.Health <1
Doesn't work.