I'm trying to load an animation into a NPC, I've tried using an animation controller but it still wouldn't work. The script being used is a local script but the NPC i'm loading it into is a "Local Part", so a normal script wouldn't effect anything.
This is the code:
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=507766666"
local animController = Instance.new("AnimationController")
animController.Parent = script.Parent
local animTrack = animController:LoadAnimation(animation)
animTrack:Play()
I feel like I'm just being stupid and there's an easy solution, thanks!

1 comment
Well, it may not be working because you never gave the animation a parent, which means that it doesn't exist really.