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

Why won't my Animation work more than once?

Asked by 9 years ago

Hello! I have recently made a falling animation! The script replaces the default animation to the one I made. However it only does this once. Then if I die or reset it goes back to the normal animation. How can I make it so it will change the animation always?

Here is the script, Also I have tried while true do, but that doesn't work.

    game.Players.PlayerAdded:connect(function(player)
    while not player.Character do wait() end
    local character = player.Character
    local animateScript = character.Animate
    animateScript.fall.FallAnim.AnimationId = 'http://www.roblox.com/asset/?id=196505089'
end)

2 answers

Log in to vote
2
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

Simply use the character added event which will fire every time a character is "added" to the player, i.e. every time they respawn.

The character added event has 1 built in parameter equal to the character that has just been added.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        print("A character was added to "..plr.Name)
    end)
end)
0
This worked! I had to modify it a little bit but it is now working full time! Thanks! minikitkat 687 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Instead of doing PlayerAdded, Try this: Add a localscript inside the StarterGui:

while not player.Character do wait() end
local character = player.Character
local animateScript = character.Animate
 animateScript.fall.FallAnim.AnimationId = 'http://www.roblox.com/asset/?id=196505089'

Answer this question