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

How do I check if a player reset?

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)

4 comments

0

is that code running from a server script?

0

Yes.

0

Humanoid.Health <1

0

Doesn't work.

1 answer

✓ Accepted answer

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)

1 comment

0

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.