So, I'm trying to learn pathfinding but this does not work why? I just want it to create bricks between start point and the end point to soon make the npc follow them. And i don't have any errors the print("Creating...") just doesn't want to print.

Server Script:

local ps = game:GetService("PathfindingService")

local pointmodel = workspace.Points

function createPath(path)
	pointmodel:ClearAllChildren()	
	
	local points = path:GetPointCoordinates()
	print("Starting to create..")
	for _, point in ipairs(points) do
		print("Creating...")
		local part = Instance.new("Part")
		part.FormFactor = Enum.FormFactor.Custom
		part.Size = Vector3.new(1,1,1)
		part.Position = point
		part.Anchored = true
		part.CanCollide = false
		part.Parent = pointmodel
	end
end

local Start = workspace.Start.Position
local End = workspace.End.Position

local p = ps:ComputeSmoothPathAsync(Start, End, 500)

createPath(p)

if p.Status == Enum.PathStatus.FailStartNotEmpty or p.Status == Enum.PathStatus.FailFinishNotEmpty then
	print("Compute failed")
	return {}
end
 
return p:GetPointCoordinates()

7 comments

1

You are using the old path finding functions check out the new path finding on the wiki page.

0

oh

0

But it made it harder for me to make an npc follow the path

0

No it uses the same system but a different function returns the data

0

ok okay but can you make so walls is invis and not cancollide so i can't walk trough them but the NPC still finds the path instead of going trough the wall?

0

is it possible for me to make*

0

i can not i can't