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

How to make a NPC move to a specific spot of the map?

I don't need a whole script I just the the gist of it. I am learning scripting and I know the basics, and some advanced scripting.

2 answers

✓ Accepted answer

Get the npc's humanoid then do Humanoid:MoveTo(Vector3.new(X,Y,Z))

Example:

npc.Humanoid:MoveTo(Vector3.new(43,0,2))

or if you wanna move the npc to a specific part you can do Humanoid:MoveTo(workspace.Part.Position)

Example:

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

But if there is a wall in the npc's path he just gonna keep walking into it because this method doesn't use pathfinding that you can read about more here wiki.roblox.com/index.php?title=Pathfinding

2 comments

0

I just want to point out that as long as a model has a humanoid, using MoveTo can just be used on the model not needed to go to the humanoid

0

Yes good you pointed it out but there is a diffrence. If you use :MovTo() on a model then it will immediately teleport the model to the position you enter, but if you use :MoveTo() on a Humanoid then the model will walk to the position it was given.

humanoid = game.Workspace.NPC.Humanoid
while true do
humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Baseplate)
wait(3)
humanoid:MoveTo(Vector3.new(Put position here), game.Workspace.Baseplate)
wait(3)

1 comment

0

Oh yeah add an end at the end

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