function API.FindPath(N,v,f)local D={}local i={}local u local V=false repeat u=pathfindingService:ComputeRawPathAsync(v,f,500)table.insert(i,u)if u.Status~=Enum.PathStatus.FailStartNotEmpty and u.Status~=Enum.PathStatus.FailFinishNotEmpty then for v,f in pairs(u:GetPointCoordinates())do table.insert(D,f)end if u.Status==Enum.PathStatus.ClosestOutOfRange then v=D[#D]if#i>=MAX_PATHS then V=true break end end end until u.Status~=Enum.PathStatus.ClosestOutOfRange if#D>2 then D=SimplifyPointsStraight(SimplifyPointsDiagonal(D))end return CreatePathObject(i,D,V and Enum.PathStatus.ClosestOutOfRange or u.Status)end function API.SetEmptyCutoff(f,v)pathfindingService.EmptyCutoff=v end
-------------------------------------------------------------------------------
-- API:

function API:FindPath(pointA, pointB)
	local points = {}
	local paths = {}
	local path
	local tooLong = false
	repeat
		path = pathfindingService:ComputeRawPathAsync(pointA, pointB, 500)
		table.insert(paths, path)
		if path.Status ~= Enum.PathStatus.FailStartNotEmpty and path.Status ~= Enum.PathStatus.FailFinishNotEmpty then
			for _, pt in pairs(path:GetPointCoordinates()) do
				table.insert(points, pt)
			end
			if path.Status == Enum.PathStatus.ClosestOutOfRange then
				pointA = points[#points]
				if #paths >= MAX_PATHS then
					tooLong = true
					break
				end
			end
		end
	until path.Status ~= Enum.PathStatus.ClosestOutOfRange
	if #points > 2 then
		points = SimplifyPointsStraight(SimplifyPointsDiagonal(points))
	end
	return CreatePathObject(paths, points, (tooLong and Enum.PathStatus.ClosestOutOfRange or path.Status))
end

function API:SetEmptyCutoff(emptyCutoff)
	pathfindingService.EmptyCutoff = emptyCutoff
end
