Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

0
For those who are asking what is the error in the output, there is none. KowruHiwatchiin 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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
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. ScottVulpes 105 — 3y
0
it didnt work i put in the script and put in the id and it still didnt work KowruHiwatchiin 0 — 3y
0
The script is supposed to be a 'child' of the dummy / npc Omzure 94 — 3y
0
So you mean the script is under the model? because it is already KowruHiwatchiin 0 — 3y
Ad

Answer this question