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

Can anyone help me with this animation script?

Asked by
Dax4244 20
8 years ago

i made a jump animation script but when i did it worked but when you reset and or respawn it does not run anymore heres the script

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=253057842"
end)
0
I do not think I will be able to solve this one, it is very confusing. TerrodactyI 173 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

The reason it only works until you reset/respawn is because the AnimationId is not being changed when the character is added, so the animation does not work and the script will not run.

To fix this, you should use the CharacterAdded event to make sure the AnimationId of the animation is changed every time the player respawns.

Game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character) --CharacterAdded event being added to the script.
        local animateScript=character:WaitForChild("Animate") --Waits until Animate is found in the character.
        animateScript.jump.JumpAnim.AnimationId="http://www.roblox.com/asset/?id=253057842"
    end)
end)

I hope my answer helped you. If it did, be sure to accept it.

Ad

Answer this question