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?
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)