Create nodes that can move up ramps/wedges

I’m creating a module script that sets up multiple nodes from a base part that could be used for pathfinding, i want to know how i could get it to detect ramps. And if there is a ramp, to move up the ramp until reaching the top of the ramp

local NodeSetup = {}

local Nodes = {}

function NodeSetup.CreateNodesFromPart(Part: Part, Visible: boolean)
	local NodeDistance = 3
	local Origin = Part.Position
	local Queue = {Origin}
	local Visited = {}

	while #Queue > 0 do
		local CurrentPosition = table.remove(Queue, 1)

		if not Visited[CurrentPosition] then
			Visited[CurrentPosition] = true
			Nodes[#Nodes + 1] = CurrentPosition

			if Visible then
				local NodePart = Instance.new("Part")
				NodePart.Size = Vector3.new(1, 1, 1)
				NodePart.Position = CurrentPosition
				NodePart.Anchored = true
				NodePart.Parent = game.Workspace
				NodePart.CanCollide = false
			end

			local Directions = {
				Vector3.new(NodeDistance, 0, 0),
				Vector3.new(-NodeDistance, 0, 0),
				Vector3.new(0, 0, NodeDistance),
				Vector3.new(0, 0, -NodeDistance),
				Vector3.new(NodeDistance, 0, NodeDistance),
				Vector3.new(NodeDistance, 0, -NodeDistance),
				Vector3.new(-NodeDistance, 0, NodeDistance),
				Vector3.new(-NodeDistance, 0, -NodeDistance),
			}

			for _, Direction in ipairs(Directions) do
				local NewPosition = CurrentPosition + Direction
				local RaycastResult = game.Workspace:Raycast(CurrentPosition, Direction)

				if not RaycastResult or not RaycastResult.Instance.CanCollide then
					if not Visited[NewPosition] then
						table.insert(Queue, NewPosition)
					end
				end
			end
		end
	end
	
	print(Nodes)
end

return NodeSetup