✓ Accepted answer
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)
2 comments
So are you trying to make a death animation? As to if the player dies an animation plays everytime a player dies?
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.