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

How do I make a "Player died" message?

How do I make a message appear when a player dies? ( Sort of like the script below)

game.Players.PlayerAdded:connect(function(plr)
   print(plr.Name.." Has Joined the game")
end)

2 comments

0

More or less is there a PlayerDied function :)

0

Do your research, a quick google or wiki search could have gotten you the answer.

1 answer

Died

Roblox has an event that fires whenever a Humanoid 'Dies'. It's exactly as it sounds, it's the 'Died' event.

It's fired when the Health Property of a Humanoid reaches 0 or below.


Directly From The Wiki:

Fired after a character's health reaches 0. Which could be caused either by disconnecting their head from their torso, or directly setting the health property.


You have to bind the event to the Characters Humanoid in order for it to work.

Here is an example of it in code:

game.PlayersPlayerAdded:connect(function(plr)
 print(plr.Name .. " has joined the game!")
	plr.CharacterAdded:connect(function(chr)
		chr:WaitForChild("Humanoid").Died:connect(function()
			print(plr.Name .. " has died!")
		end)
	end)
end)

Link

http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Died

1 comment

0

Awesome, thanks :)

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