Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I animate an NPC with an AnimationController?

Asked by 7 years ago

I have the warrior moving to a certain position, but he is not being animated. I just used the walking anim from my player. I welded all the parts of him too.

local warrior = script.Parent.Parent

--Animations
local walkAnim = warrior.Anims.Walk

--Variables
local animTrack = nil
local canPlay = true

function playWalk()
    if canPlay then
        canPlay = false
        animTrack = warrior.AnimationController:LoadAnimation(walkAnim)
        wait()
        warrior.Humanoid:MoveTo(game.Workspace.walkPart.Position)
        animTrack:Play()
    end
end

wait(3)

playWalk()
0
Perhaps try connecting your rig w/ motors Goulstem 8144 — 7y
0
I only use AnimationController on Objects. I use normal animate on npcs WHITEHH 0 — 7y

1 answer

Log in to vote
0
Answered by
leathei -5
6 years ago
Edited 6 years ago

This is a hard one.

Now here is a script to put the animation to a specific spot.

1-- Assuming your NPC has a humanoid... 2 script.Parent.Humanoid:MoveTo(0, 0, 0) -- Replace the 0's with desired coordinates. (X, Y, Z)

You can put a wait (number) in there so your NPC can be walked when timed.

You can also use animation editor and get the animation in the script, for example.

01-- Assuming your NPC has a humanoid... 02 script.Parent.Humanoid:MoveTo(0, 0, 0) -- Replace the 0's with desired coordinates. (X, Y, Z) 03 wait (3) -- 3 is the example number... 04-- Drag the animations in the script. 05-- Sooner or later test the game

(If It did not work sorry.)

Ad

Answer this question