Help with Idle animation script(fixed)

I am making a game that requires an animation to play when the player is standing still, I have tried using the Animate script and change the idle animation but that didn’t work, I thought this script would work but it doesn’t. No errors in output but it prints the “Play” or “Stop” anything I can change to make it work?

while wait(0.1) do
    local animation = script:WaitForChild('AnimationID')
    local humanoid = script.Parent
    local dance = humanoid:LoadAnimation(animation)
    print("Animation Loaded")
    if script.Parent.WalkSpeed == 0 then
        print("Play")
        dance:Play()
    elseif script.Parent.WalkSpeed >= 0 then
        print("Stop")
        dance:Stop()
    end
end
1 Like