MoveTo on R15 Rig not working

Hey,

So I am trying to make a Tower Defense game, and I have this simple NPC:
enemy

(simple r15 rig with modified colors)
and I am trying to call MoveTo on the humanoid, but for some reason it’s not working.

I have tried multiple things that were listed online, but none of them have seen to work so far.
It’s literally not moving, even though I literally did what was listed here .
My code is simply:

game.Selection:Get()[1]:MoveTo(workspace.Part.Position)

The WalkToPoint in the humanoid does change, but I see no movement.

I suspect this is because there’s not any Animate script inside of it, but I am unsure if this is actually the issue.

Thanks!

1 Like

Did you check that all of the parts are un-anchored? If you generated the NPC with the animation rig builder plugin the HumanoidRootPart is anchored by default.

7 Likes

Will test that right now, 1 sec

So I could test it while not having to start the game, because there’s gui’s that open as soon as I start the game

Thanks! Worked, turned out I had to anchor & unanchor everything and for some reason it worked. :man_shrugging:

1 Like

Yes, I was using the run option to test it.

1 Like

game.Selection:Get()[1]:SetPrimaryPartCFrame(workspace.Part.CFrame * CFrame.new(0,3,0))

This method should be more reliable in your situation than :MoveTo()

If you have any questions feel free to contact me!

1 Like

I believe he is using the MoveTo method of a Humanoid instance, which takes a Vector3 as its first argument.

1 Like

Doesn’t appear so in this code.

But I see now,

game.Selection:Get():WaitForChild("Humanoid"):MoveTo(game.Workspace.Part.Position)

I would recommend looking for the Humanoid manually with either FindFirstChild or WaitForChild just due to the fact that you don’t always know that the humanoid can be the first index in the character.

This could prevent any potential errors later down the line.

1 Like

I do that in my main code, that was just for testing though.

This worked. I generated my rig using the Rig Builder plugin. For some reason the “HumanoidRootPart” was anchored by default. Un-anchoring this did the trick.

1 Like