How to add rivers in Perlin Noise generation?

Working on the hexagonal-tile terrain generation aspect of an upcoming project and I’ve came to an issue.

I’m trying to add river-looking structures in but it doesn’t seem to work. I’ve tested with perlin worms by making a path and then painting the hexes blue, but that still doesn’t work.|

Here’s the script:

local MapFolder = game.Workspace.Map



local Relief = 10
local TileExample = game.Workspace.tile
local event = game.ReplicatedStorage.Event

local topX = {0,0,0,0,0}
local topY = {0,0,0,0,0}

local yres = 25
local xres = 25
local val = 0

local function CusNoise(X,Y,seed,seed2)
	return (math.noise(X+seed/100,Y+seed/100)+math.noise(X+seed/100+seed2,Y+seed2/100))/2
end

local function Display(seed,seed2)
	local peaks = {0,0,0,0,0}
	local peakspots: {BasePart} = {}
	for X=1, xres do
		for Y=1, yres do

			local newtile = TileExample:Clone()
			newtile.Anchored = true
			newtile.Position = Vector3.new(X*4-((Y%2)*2),4,Y*3)
			newtile.Parent = MapFolder
			

			val+=1
			if val>150 then
				val = 0
				task.wait(.2)
			end
			local noise = CusNoise(X,Y,seed,seed2)



			for i=1,5 do
				if noise > peaks[i] then
					if i < 5 then
						peaks[i-1]=peaks[i]
						peaks[i] = noise
						peakspots[i]=newtile
						else
					peaks[i]=noise
						peakspots[i]=newtile
						topY[i] = Y
						topX[i] = X
						break
						end
				end
			end
			newtile.Size = Vector3.new(4,2+((noise+.5)*4),4)
			

		end
		
	end

	peakspots[1].Color = Color3.fromRGB(255,255,0)
	peakspots[2].Color = Color3.fromRGB(100,100,100)
	peakspots[3].Color = Color3.fromRGB(150,75,0)
	
	for i, v in peakspots do
		task.wait(1)
		local rparams = RaycastParams.new()
		local getpart = v
		rparams.FilterType = Enum.RaycastFilterType.Blacklist
		rparams.FilterDescendantsInstances = {v}
		while getpart do
			local noise = CusNoise(topX[i],topY[i],seed,seed2)
			local rot = ((noise+.5)*360)-180
			local ray = workspace:Raycast(getpart.Position-Vector3.new(0,getpart.Size.Y-.2,0),Vector3.new(0,rot,0),rparams)
			if not ray then getpart = nil else 			
				getpart = ray.Instance
				getpart.Color = Color3.fromRGB(0,0,255)end 
	
		end
	end
end

event.Event:Connect(function()
	MapFolder:ClearAllChildren()
	task.wait(.3)
	Display(math.random(1,200),math.random(1,200))
end)


Bumping as I’ve still not found a solution.

If anyone got some ideas/sources on adding Rivers to a perlin-noise generated map then please link it here!

bumping again after over 10m because i still havent found a solution

You sure this is right? …

also

local function AddRivers(seed, seed2)
  
    local riverPaths = {}
    for X = 1, xres do
        for Y = 1, yres do
            local noise = CusNoise(X, Y, seed, seed2)
            if noise < 0.2 then
                table.insert(riverPaths, Vector3.new(X * 4 - ((Y % 2) * 2), 0, Y * 3))
            end
        end
    end

    for _, riverPos in ipairs(riverPaths) do
        for _, tile in ipairs(workspace:FindPartsInRegion3(MapFolder.Position + riverPos - Vector3.new(2, 0, 2), MapFolder.Position + riverPos + Vector3.new(2, 0, 2), nil)) do
            tile.Size = Vector3.new(4, 1, 4)  -- Lower the height for riverbed
            tile.Color = Color3.fromRGB(0, 0, 255)  -- Set water color
        end
    end
end

and lower in the script

    Display(math.random(1, 200), math.random(1, 200))
    AddRivers(math.random(1, 200), math.random(1, 200))

there is no way to test this so .. that’s my guess.