Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Moving the NPC without using pathfinding?

I'm creating short cutscenes like flashbacks, is there an easier way to move NPCs (with a walk animation) without using pathfinding?

I saw some tutorials that used NPC.Humanoid.MoveTo(position) etc, but it did not work (probably outdated).

2 answers

Using MoveTo is fairly simple. It takes a Vector3 as the argument and makes the character find the shortest way to the position and go towards it (note that it won't avoid obstacles)

Example:

workspace.NPC.Humanoid:MoveTo(Vector3.new(10,0,5))

You can also make it go to a part's position

workspace.NPC.Humanoid:MoveTo(workspace.Part.Position)

1 comment

0

I've used that, but idk why its not working for me. I'll try again.

As long as your NPC contains the default ROBLOX scripts for characters, you should be able to use the WalkToPoint property of the Humanoid. For example, something like:

NPC.Humanoid.WalkToPoint = Vector3.new(10, 0, 10)

Would make your NPC walk to the point (10, 0, 10) at normal walking speed and with the animation. If you want to change the walking speed, you can just use the WalkSpeed property of the Humanoid, which defaults to 16.


Anyways, I hope this helps. If you have any further questions, let me know and I will do what I can to help.

This discussion is preserved as it was. New answers, comments, and votes are closed.