I have a simple animation for an NPC. There's a script in the character with and animation inside. The AnimationID of it are the numbers that come up from the animations tab on the website link.
The script goes like this:
local anim = script:WaitForChild('Animation') local hu = script.Parent:WaitForChild("Humanoid") local dance = hu:LoadAnimation(anim) wait(1) dance:Play()
But for some reason it doesn't do anything. When I put in a print after the Play()
eg:
wait(1) dance:Play() print('Played')
It DOES print 'Played' although I can't see it animating.
Is there a different ID I need to use for the animation? I know for gamepasses there is a different Data-Asset-ID, so is there something similar for animations too?
Please help.
Actually it seems about right. Try changing script:WaitForChild("Animation")
to script.Animation
Everything seems right.
Here are the things you need to check for:
If the NPC is anchored, unanchor it.
If you want the NPC to not move, even though you need the NPC unanchored, then anchor the HumanoidRootPart
Another way is to add this script:
script.Parent.Parent.HumanoidRootPart.Anchored = true
Hope this helps!
The problem is that you're setting something that isn't really a variable (things like do, time, then, cannot be changed)
You can see them easily, it's highlighted in blue (unless you change the colors!)
--> Answer
Change your variable to another one, like animTrack
Try if this works:
local Animation = Instance.new('Animation') local AnimTrack = nil Animation.AnimationId = "" -- paste your animation id here AnimTrack = humanoid:LoadAnimation(Animation) AnimTrack:Play()
Turns out that place is just broken because when I tried a different place with the EXACT SAME THINGS it worked. :/