Died (Event)

From Legacy Roblox Wiki
Revision as of 15:42, 29 January 2011 by >Camoy
Jump to navigationJump to search
Died ( )
Description Fired after a Humanoid dies.
Member of: Humanoid


Description

Died event is triggered when Humanoid "dies" either because Health is 0 or because the Head and Torso are disconnected (Broken joints or one or both is removed).

The event occurs after the automatic BreakJoints in model upon death, but before character falls and is removed.

Example
local function onDied(character)
	--do on death
end

local function onCharacterAdded(character)
	character.Humanoid.Died:connect(function()
		onDied(character)
	end)
end

local function onPlayerAdded(player)
	player.CharacterAdded:connect(onCharacterAdded)
end

game.Players.PlayerAdded:connect(onPlayerAdded)