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

The animation for my npc isnt working, can anyone help?

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

for some reason the animation isnt playing on my npc please help

1 comment

0

For those who are asking what is the error in the output, there is none.

1 answer

First of all, you need an animation ID.

You can't just put in 'animation' and expect it to do something.

Here's what I do, and what you should do as well for this script:

local animation = Instance.new("Animation") --this creates an animation object

animation.AnimationId = "rbxassetid://1234567890" --this gives it an id, which is what u were missing

local control = script.Parent.Humanoid --this assigns what the animation controller is, and if it is an animation controller (created by instance) or if it's a humanoid

control:LoadAnimation(animation):Play() --the controller loads the animation (as created earlier) and plays it

--bartbpatel

4 comments

1

Well, this does work, but you don't actually need a animationId if you already have a animation with it's property changed already outside of the script.

0

it didnt work i put in the script and put in the id and it still didnt work

0

The script is supposed to be a 'child' of the dummy / npc

0

So you mean the script is under the model? because it is already

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