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

How to implement a death animation?

So currently I have this script:


Game.Players.PlayerAdded:connect(function(player)

	while not player.Character do wait() end
	local character = player.Character
	local animateScript = character.Animate
	animateScript.death.Animation1.AnimationId = 'http://www.roblox.com/asset/?id='
end)

Yeah I tried it and it doesn't work. It is probably the death part. Would anyone tell me how to make it so that when a player's health goes to 0 it plays the animation?

3 comments

0

Please format your question so that all code is within a code block

0

please fix your formatting

0

fixed it

2 answers

function onDied()
	--do your stuff
end

game.Players.LocalPlayer.Character.Humanoid.Died:connect(onDied)

It's simple, really. There is a "died" event for humanoid.

I do not think that is possible as they always break joints what I'd suggest is making a fake health and when it hits 0 play an animation. then :LoadCharacter() after it finishes.

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