Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Am I Loading This Animation Correctly?

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

0

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

1 answer

As what ScrubSadmir said, there's no parent. There must a parent present for it to work. Try inserting a dummy or something.

This discussion is preserved as it was. New answers, comments, and votes are closed.