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

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

Asked by 9 years ago

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

Log in to vote
3
Answered by
Kryddan 261 Moderation Voter
9 years ago

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

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 BSIncorporated 640 — 9y
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. Kryddan 261 — 9y
Ad
Log in to vote
0
Answered by 5 years ago
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)
0
Oh yeah add an end at the end DogHouseForMe 0 — 5y

Answer this question