Putting default walk animation into a rig

Hello devs!

I am using Humanoid:MoveTo() to make a bunch of rigs walk to one location. They move to the location, but they have no animations. I have tried to search the answer up on youtube and the devforum, but all of their solutions are for players.

Does anybody know how to insert a walking animation into a rig that is not the player?

Animate.rbxm (10.0 KB)

Insert this animate script into your character(s) and this should fix your animation “glitch”!
Mark this as solution if this helps :smiley: ! If it doesn’t please reply to me with what is happening!

None of the animations are playing, but there is no error in the output

Did you insert the “Animate” script into the rig?

Yes, is there a specific part I should put it in?

Ok, to your problem I assume that the regular functions of player’s character wouldn’t run with your npc.

So this can be a fix to your issue:

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")

local RunService = game:GetService("RunService")

RunService.Heartbeat:Connect(function()
    local Speed = Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).magnitude
    --// This heartbeat would allow a repeated check of your rig's movement.   

    if Speed > 1 then --// This checks the distance your humanoid is travelling and if it is moving(1) then it plays the animation.
        if IdleAnimation.IsPlaying then
            IdleAnimation:Stop()
        end
        
        if not RunAnimation.IsPlaying then
            RunAnimation:Play()
        end
    else
        if RunAnimation.IsPlaying then
            RunAnimation:Stop()
        end
        
        if not IdleAnimation.IsPlaying then
            IdleAnimation:Play()
        end
    end
end)

Be assure that “IdleAnimation” and “RunAnimation” aren’t specified so you would have to do that on your own with your variables. Please inform me if this works! :smiley:

Still not working, and there are no errors. I set IdleAnimation and WalkAnimation to animation objects inside each rig.

Put the “Animate” script inside your character or NPC.

Baseplate.rbxl (52.2 KB)

I’ve already tried this, and tried it with your script now, but they still are not animating. Is using MoveTo() a problem? I don’t think it is because I am using it with the local player and it works, but maybe it is not the same for NPC’s

Are your rigs r15? do all the body parts have the right names? I’ve never really had an issue with this so it’s kind of hard to say whats wrong. If you want to post the place i can look at it for you otherwise im not really sure.

They are R15, and I used a plugin to make them, so they should be welded and named correctly. Looks like I’ll have to research this more.

Make sure your joints are named properly (RightHip, LeftHip) etc.

my last bit of help would be this which was posted by another user:

Your dummy called “builderman” most likely has no animation script that is usually located inside of Humanoid Models. Start a game test, grab your LocalScript called “Animate”, copy and paste its contents on a Script and make sure to remove the Emote part of the code and to put the correct variables so the game knows you’re not messing with a Player, but a NPC.

If everything goes well, your dummy should be animated correctly now!

If you’re having trouble finding the emote part, make sure to use CTRL + F to open the search tool. Use the keyword “Emote” and you should find some useful results.

You should use:

Humanoid.MoveDirection.Magnitude

I bet the “Animation” script is in clientside / a local script, change it to normal / server script should fix it, i tried and it worked.