Using a animator to animate npcs?

So I want to animate my npcs. These npcs do not have an Animate script so I’ve determined to use an animator object. Here are my questions

  1. How would I play these animations? using humanoid:LoadAnimation() or something different?
  2. Should I play the animations on the client or server?
  3. Should I even use an animator or should I use a different method?
  4. If I should use an animator, would humanoid:GetPlayingAnimationsTracks() still work?

Any replies are appreciated!

I have a huge problem with my game and I need help with this.

It depends on what you want:

  • If you want to animate them when attacked, use humanoid:LoadAnimation() the script can be in a hitbox or in the weapon
  • If you want them to have walking or jumping animations, you can grab your character localscript when starting the game (R6 or R15) and put it on the npc. The script is called “Animation”
  • If you want to put custom animations do the same but in the localscript children values ​​change the Id of the animation for yours

You should have a reference, you can take an animated one from the toolbox, to find out if its similar to your npc, Animator or not, R6 or R15

I want to play action animations from a external script.

Is this an external script? you put that in each of your npcs and work solved.

image

The script there is the same as is in your character when entering the game

I don’t want to use an animate script. I want to play animations (not walk or jump ect.) from a script in server script service.

Ok I think this is the solution, just copy the base, this will make the animation play for each of your npcs
If this doesnt help you, I cant do anything anymore…

for i,v in pairs(game.Workspace.NPCS:GetChildren()) do -- all the npcs
	v.Touched:Connect(function() -- npc when touched
		local Animation = Instance.new("Animation") -- creates the animation
		Animation.AnimationId = "rbxassetid://0" -- your animation id
		local Humanoid = v:FindFirstChild("Humanoid") -- npcs with humanoid
		local animtrack = Humanoid:LoadAnimation(Animation) -- load the animation
		wait(1) -- wait
		animtrack:Play() -- Play your animation
	end)
end

Create a folder called “NPCS” and there you put all your npcs, and they will make the animation when touched, but you do not need to copy the script