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

why wont my animation replacement script work?

Asked by
Kaput_0 44
4 years ago

I am using an animation script made by Roblox to replace default animations with your own (the article: https://developer.roblox.com/en-us/articles/using-animations-in-games) it works and it loops the animations for me but after a few loops the character just freezesor stands up stiff and I want to know how to fix this

local Players = game:GetService("Players")

--https://www.roblox.com/catalog/03830250233/redirect

local function onCharacterAdded(character)
    local humanoid = character:WaitForChild("Humanoid")

    for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
        playingTracks:Stop(0)
    end

    local animateScript = character:WaitForChild("Animate")

    animateScript.idle.Animation1.AnimationId = "rbxassetid://3824488291"
    animateScript.run.RunAnim.AnimationId = "rbxassetid://3839149642"
    animateScript.walk.WalkAnim.AnimationId = "rbxassetid://3839149642"
end

local function onPlayerAdded(player)
    if player.Character then
        onCharacterAdded(player.Character)
    end
    player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

Answer this question