Why does this npc not play animation?

Hi, Okay i know i litterly made a post a second ago but, For some reason my script does not make the npc play the animation, Heres the script:

local arifgamer = script.Parent

local Character = game.Players.LocalPlayer.Character

local Humanoid = Character:WaitForChild("Humanoid")

local Runservice = game:GetService("RunService")

local Animation = arifgamer.Humanoid.Animator:LoadAnimation(script.Parent.Animation)

Runservice.RenderStepped:Connect(function()
	if Humanoid.MoveDirection.Magnitude > 0 then
		Animation:Play()
	end
end)

So how could i fix this

Is there anything in the output?
Where is the localscript located?

Localscripts only run when they’re a descendant of the player, inside of their character or in replicatedfirst.

Edit: I’m assuming arifgamer is a different character model than the player’s character, therefore the script just isn’t running. Move it somewhere localscript - friendly. (the previous list)

if the npc is controled by server, use a server script,
and in this script, you are checking your own Character’s Humanoid move speed, and based on this you try to animate the npc. is this correct though?

Yes i am trying to check if the player is moving

okay so is your npc owned by server, or is it a local spawned npc?
if it is owned by server, you need to use server script to animate