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

What is the function to connect a death?

Is it

function ConnectOnDeath()

I'm stuck in writing the code I'm doing. It makes a number in the GUI go down when you die.

2 answers

✓ Accepted answer

This should help. You need to indicate what ConnectOnDeath() is.

local player = game.Players.LocalPlayer

function ConnectOnDeath()
--Rest of Script
if player.Character.Humanoid.Health == 0 then
ConnectOnDeath()
end

Here you go. Because your question wasn't very detailed this is the best i could get out of it.

This event triggers when a player dies.

game:GetService('Players').PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
			print(player.Name .. " has died!")
		end)
	end)
end)

Article: http://wiki.roblox.com/index.php?title=Died

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