Animation not playing. (NPC idle animation)

Title says it all, I’m trying to add an idle animation to a stationary NPC, but for some reason nothing works.

ServerScript:

local animationId = "rbxassetid://10777554675"
local Humanoid = script.Parent.Humanoid
local A = Instance.new("Animator")
A.Parent = Humanoid
local Animator = Humanoid.Animator
local animation = Instance.new("Animation", Humanoid)
animation.AnimationId = animationId 
local Animation = Animator:LoadAnimation(animation)

Animation.Looped = true
while true do
	warn(Animation.Length)
	warn("Starting")
	Animation:Play()
	task.wait(3)
	warn("Played")
end

hello did you use a models free …??

You should try setting the animationTrack’s Looped method first before playing.
Also, the LoadAnimation method of humanoid is deprecated. More information: Deprecating LoadAnimation on Humanoid and AnimationController

instead of adding animation using script add animation itself, then put the animation id in there
and do this in the script.

local animation = script:WaitForChild("Animation")
local meh = script.Parent.Humanoid.Animator
task.wait(0.1)
meh:LoadAnimation(animation):Play()
print("Playing")

Ain’t working either. “Playing” prints, but no animation is played.

It is loading on the animator already.

If you’re still having this problem is most likely lies in the animation itself as I copy and pasted that script and it works fine for me, only thing I can think of is not owning the animation or having permission to use it.

How can someone give you permission to use an animation?

There is no way to give/get permission according to this for an animation I typed that in because I wasn’t sure if their was a way (like sounds).