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

Why animations reset after respawn?

Asked by 10 years ago

I use roblox script to change the anims and so I want to change idle one. It works but after respawn anims break and they don't work.

This one is suggested by someone but doesn't work.

game.Workspace.ChildAdded:connect(function(player)
if Workspace[player.Name]:findFirstChild("Humanoid") ~= nil then
while not game.Players[player.Name].Character do
wait()
end
end

local character = Workspace[player.Name]
local animateScript = character.Animate
animateScript.idle.Animation1.AnimationId = "http://www.roblox.com/asset/?id=80980242"
end)

And the ROBLOX one:

Game.Players.PlayerAdded:connect(function(player)
    while not player.Character do wait() end
    local character = player.Character
    local animateScript = character.Animate
    animateScript.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=80980242'
end)

Please help been trying to solve this for 3 days!

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

This puts it in when the play enters, but not when they respawn. You need to use the CharacterAdded event.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        --code
    end)
end)
Ad

Answer this question