The animation on the npc does not play for some reason, here’s the code that plays it, its really simple.
controller:LoadAnimation(script.Animation):Play()
The animation on the npc does not play for some reason, here’s the code that plays it, its really simple.
controller:LoadAnimation(script.Animation):Play()
I don’t know if this is what you’re looking for, but I think you want an animation you made to play on an NPC? Whenever I do that I just do…
local animationId = 00000 --Change to your ID
game.InsertService:LoadAsset(animationId).Parent = game.ReplicatedStorage
local controller = script.Parent.Humanoid
controller:LoadAnimation(script.Animation):Play()
And then insert an Animation to it and change that too. I’m not the best scripter though… this is just what I use.
Is your animation a descendant of the humanoid?
What I use is actually pretty simple.
Insert a script in the npc and add an animation into the script (and change the animation id to whatever your animation id is)
And then implement this code into the script:
local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()
This works for me. If it doesn’t work for you, just tell me and I’ll try to help you.
Note : Server Script
local NpcLoader = script.Parent:WaitForChild("Humanoid")
local Animation = NpcLoader:LoadAnimation(script.Animation)
Animation:Play()
Could you send us the whole script and the output? It would help a lot.
AnimationController and Humanoid LoadAnimation functions are depricated, use animator
local id = 0 -- id here
local Animator= Model.Animator
Animator:LoadAnimation(Instance.new("Animation").AnimationId(id)):Play()