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

Why does this animation script stop after I die?

Asked by 8 years ago
game.Players.PlayerAdded:connect(function(player)
    while not player.Character do wait() end
    local character = player.Character
    local animateScript = character.Animate
    animateScript.jump.JumpAnim.AnimationId = 'http://www.roblox.com/asset/?id=340097749'
    end)

This Anim script stops playing after I die. How do I fix the issue?

0
So are you trying to make a death animation? As to if the player dies an animation plays everytime a player dies? KingLoneCat 2642 — 8y
0
No, a jump animation. For example, I made a jump animation, all the time I'm alive, it plays every time I jump. But when I die or respawn, when I jump, it just goes back to the original jump animation. Not the one I made. james24dj 90 — 8y

1 answer

Log in to vote
1
Answered by
XAXA 1569 Moderation Voter
8 years ago

http://wiki.roblox.com/index.php?title=API:Class/Player/CharacterAdded

Try using the CharacterAdded event in conjunction with PlayerAdded. This way, the animation is replaced every time the player spawns instead of just once when the player enters the game.

I would also recommend storing the animation as its own variable, to make future changes easier.

local JUMP_ANIM_NEW = 'http://www.roblox.com/asset/?id=340097749'

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local animateScript = character:WaitForChild("Animate")
        local jump = animateScript:WaitForChild("jump")
        local JumpAnim = jump:WaitForChild("JumpAnim")
        JumpAnim.AnimationId = JUMP_ANIM_NEW
    end)
end)

0
Thanks for the wiki link and script m8! james24dj 90 — 8y
Ad

Answer this question