Animating an NPC - LoadAnimation working in test but not in a live server

This code seems to work fine in Studio, but it’s not doing anything in live games:

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()

Is there something wrong with the way that’s handling it? I looked up a few existing threads but didn’t see much that helps here. The Animation priority is set to Action, so that shouldn’t be the problem.

Also, the script is running server-side in an NPC character, if that has to do with it at all.

1 Like

Maybe it doesn’t loop and it end the animation before u get to see it

1 Like

The animation loops so that wouldn’t be it, thanks for the help though!

1 Like

I think you forgot to commit the script in Drafts page

1 Like

Is the animation in a server script? Since you said it runs in Studio, but not live, that could be the reason.

1 Like