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
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
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
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.
it didnt work i put in the script and put in the id and it still didnt work
The script is supposed to be a 'child' of the dummy / npc
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.
1 comment
For those who are asking what is the error in the output, there is none.