Custom Rig NPC Animations

I have animations for a custom rig’s idle and walking. How would I play the walking animation when the NPC is walking, vice versa with idle?

1 Like

Try copying the “Animate” script from your default character then place it inside “StarterCharacterScripts” or inside the custom character and change it’s animations.

2 Likes

I would do that, but the parts are different from R15. It’s a custom rig. For an NPC…

1 Like

I did a little test and made the following script (Local):

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://" .. "6124459812" --your animation id
local npc_humanoid = game.Workspace:WaitForChild("Dummy"):FindFirstChild("Humanoid")
local track = npc_humanoid:LoadAnimation(anim)

npc_humanoid.Running:Connect(function(speed) --event listener for when hum is running
	if speed > 0 then --check if it's moving
		track:Play() --play your animation
	else
		track:Stop() --stop when it's not moving
	end
end)

I only added the walk animation but if you want to add an idle then just add another animation and when speed > 0 do idle:Stop() else idle:Play()

1 Like

LocalScripts wont work inside of NPCS?

Hello dockboy20006!

To control non-humanoid things with animations, you can use an AnimationController. Otherwise, you can load the animation onto the humanoid and play it as normal.

If you were looking to play the animation while it is walking, you can do what zakater said or hook on Humanoid:MoveTo()

Run animations locally. They will be much smoother. Generally, you want to reduce as much overhead and visuals to reduce load on the server. Plus, client-side animations tend to be smoother (relative to the client’s machine)

1 Like