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

How do I make NPC walk using pathfind?

Asked by 7 years ago
Edited 7 years ago

Alright, so I can pathfind and I make bricks appear to show a path. Now, how can I make NPC walk here? Here is the code :


while true do local path = game:GetService("PathfindingService"):ComputeRawPathAsync(game.Workspace.Stuff.Start.Position, game.Workspace.Stuff.ENd.Position, 200) print(path.Status) local points = path:GetPointCoordinates() wait(1) local points = path:GetPointCoordinates() for _, point in ipairs(points) do local part = Instance.new("Part") part.FormFactor = Enum.FormFactor.Custom part.Name = "Pathfind" part.Size = Vector3.new(1,1,1) part.Position = point part.Anchored = true part.CanCollide = false part.Parent = workspace.Pathfind path:ClearAllChildren() end wait(0.1) end

I would be happy if anyone could help out.

0
Why did you redefine points? hiimgoodpack 2009 — 7y

1 answer

Log in to vote
0
Answered by
blowup999 659 Moderation Voter
7 years ago
npc.Humanoid:MoveTo(point)
Ad

Answer this question