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

How do I make NPC walk using pathfind?

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.

1 comment

0

Why did you redefine points?

1 answer

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