Hi, I'm a beginner scripter and I'm trying to figure out how to use the Pathfinding service. I've watch the Roblox tutorial and tried to get this working multiple times but have failed.

Here is my script,

path = game:GetService("PathfindingService"):ComputeRawPathAsync(workspace.Start.Position, workspace.Finish.Position, 200)

points = path:GetPointCoordinates()

for p = 1, #points do
	script.Parent:MoveTo(points)
end

Thanks

4 comments

0

If you haven't read this, this is a really good guide imo https://www.robloxdev.com/articles/Making-a-Patrolling-NPC-in-Roblox

0

Use local variables. Globales are bad practice.

0

Thanks for the link to the article it's very helpful!

0

No problem