Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to implement a death animation?

Asked by 9 years ago

So currently I have this script:

1Game.Players.PlayerAdded:connect(function(player)
2 
3    while not player.Character do wait() end
4    local character = player.Character
5    local animateScript = character.Animate
6    animateScript.death.Animation1.AnimationId = 'http://www.roblox.com/asset/?id='
7end)

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?

0
Please format your question so that all code is within a code block User#6546 35 — 9y
0
please fix your formatting koolkid8099 705 — 9y
0
fixed it RareFighterPilot 0 — 9y

2 answers

Log in to vote
2
Answered by 9 years ago
1function onDied()
2    --do your stuff
3end
4 
5game.Players.LocalPlayer.Character.Humanoid.Died:connect(onDied)

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

Ad
Log in to vote
0
Answered by
Hero_ic 502 Moderation Voter
9 years ago

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.

Answer this question