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 8 years ago

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?

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

2 answers

Log in to vote
2
Answered by 8 years ago
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.

Ad
Log in to vote
0
Answered by
Hero_ic 502 Moderation Voter
8 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