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 10 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
10 years ago

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

Example:

1npc.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:

1npc.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 — 10y
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 — 10y
Ad
Log in to vote
0
Answered by 6 years ago
1humanoid = game.Workspace.NPC.Humanoid
2while true do
3humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Baseplate)
4wait(3)
5humanoid:MoveTo(Vector3.new(Put position here), game.Workspace.Baseplate)
6wait(3)
0
Oh yeah add an end at the end DogHouseForMe 0 — 6y

Answer this question