function Pathfinder.DrawPath(N,M)assert(M and M.Status==Enum.PathStatus.Success,"\080\097\116\104\102\105\110\100\101\114\058\068\114\097\119\080\097\116\104\040\080\097\116\104\041 \114\101\113\117\105\114\101\115 \097 \118\097\108\105\100 \080\097\116\104\033")N:DestroyDrawnPath()local Z=N._DrawnPath or Instance.new("\077\111\100\101\108")Z.Name="\080\097\116\104\102\105\110\100\101\114\095\080\097\116\104"for M,N in pairs(M:GetWaypoints())do local L=Instance.new("\080\097\114\116")L.Name=string.format("\087\097\121\112\111\105\110\116\095\037\100",M)L.Anchored=true L.CanCollide=false L.Size=Vector3.new(1,1,1)L.CFrame=CFrame.new(N.Position)L.BrickColor=N.Action==Enum.PathWaypointAction.Jump and BrickColor.Blue()or BrickColor.Gray()L.Parent=Z end Z.Parent=workspace N._DrawnPath=Z return Z end function Pathfinder.DestroyDrawnPath(M)if M._DrawnPath then M._DrawnPath:ClearAllChildren()end end

function Pathfinder:DrawPath(Path)
	assert(Path and Path.Status == Enum.PathStatus.Success, "Pathfinder:DrawPath(Path) requires a valid Path!")
	self:DestroyDrawnPath()
	
	-- Generate new path visuals
	local container = self._DrawnPath or Instance.new("Model")
	container.Name = "Pathfinder_Path"
	for index, waypoint in pairs(Path:GetWaypoints()) do
		local p = Instance.new("Part")
		p.Name = string.format("Waypoint_%d", index)
		p.Anchored = true
		p.CanCollide = false
		p.Size = Vector3.new(1,1,1)
		p.CFrame = CFrame.new(waypoint.Position)
		p.BrickColor = waypoint.Action == Enum.PathWaypointAction.Jump and BrickColor.Blue() or BrickColor.Gray()
		p.Parent = container
	end
	container.Parent = workspace
	self._DrawnPath = container
	return container
end

function Pathfinder:DestroyDrawnPath()
	if self._DrawnPath then self._DrawnPath:ClearAllChildren() end
end
