local animation = script:WaitForChild("Animation")
local humanoid = script.Parent:WaitForChild("Humanoid")
local anim = humanoid:LoadAnimation(animation)
anim:Play()
This works in studio ^ But doesn't work in the game. I've had instances when messing around with the code that the NPC looks like he's about to do an animation but he's just sitting still on the first frame, forever. There's no errors or anything. I really need help as most of my fanbase wants animated workers and I need to get this game released before Christmas.

4 comments
"Otherwise you should do LoadAnimation on the humanoid", How so? animation:LoadAnimation() ???? I don't know what you're saying.
You need to rephrase this question as its too vague. A lot can be wrong here. For example, Roblox doesn't allow you to play animations that you didn't upload yourself (or if it's a group game, the animation needs to be uploaded to the group). This could be an issue as well
Done
bad grammar because my english isnt my first langauge