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 make a message when a player dies???

im still a new sceripter so i need some help, the scripting forum just makes fun of me so i come here.

i want a hint message to pop up for 5 seconds when a player dies.

1 answer

✓ Accepted answer

Hello, I see you are asking about the .Died function.

Here is an example of what you are looking for:

IN A SERVER SCRIPT

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		repeat wait() until char.Humanoid
		local humanoid = char.Humanoid
	
		local function died()
			local hint = Instance.new("Hint")
			hint.Parent = game.Workspace
			hint.Text = plr.Name.." has died!"
			wait(5)
			hint:destroy()
		end

		humanoid.Died:connect(died)
	end)
end)

Here is what we used:

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

Local functions are basically functions inside functions, which is what the died function is.

2 comments

0

thank you again gulliblechap, i think i can learn some more lua on my own, im working on learning if statements!

0

once again freezy, its no problem

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