Hello, I am working to add an Idle animation to Timmy (an NPC) but I can’t get it to work
The script named “Script” is the script I am using to try to make the animation play. The “Idle” under “AnimSaves” is the animation I am trying to play.
local player = script.Parent --The NPC model
local humanoid = player:FindFirstChild("Humanoid")
local animation = script.Parent.AnimSaves.Idle
local anim= humanoid:LoadAnimation(animation)
anim:Play()
This outputs the error “LoadAnimation requires an Animation object” and I can’t figure out how to fix this.
local hum = script.Parent:WaitForChild("Humanoid") -- Find the Humanoid
local anim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation")) -- It finds anything inside of the script that is "Animation" and loads it.
anim.Looped = true -- If your animation is not looped, you can loop it like this.
anim:Play()
Try putting the Animation under the script (then add the ID into it) instead of trying to locate it in the NPC itself.
For example;