Script not recognizing variables inside an array?

Godot 4

I’m trying to figure out what happened to this script. It’s designed to scan an assortment of tiles in a tilemap starting at a seed and return an array of coordinates.

The first version worked perfectly and I decided to move the script from the tilemap node to the scene node, amending the script appropriately to do so. Now no matter what I do, it doesn’t seem to be able to recognize the Vector2 variable in the Scanray array. More specifically, it’s stating that it can’t convert the variable from an Array to a Vector2, though I’m specifying the index. I moved the code back to the tilemap node and it’s now saying the same thing.

Several troubleshooting attempts have been made, including putting the value into a separate variable that’s specifically a Vector2, but that won’t take the index either, citing the same issue. I know for a fact the Scanray array’s first index is a Vector2. I’m at a loss, and this function is an integral ingredient in my game. What am I missing?

extends TileMap

@export var seedx:int =1
@export var seedy:int =1

var Scanray:=[]
var Rendray:=[]

func _ready():
	pass
	Set(Vector2(seedx,seedy))

func Set(Seed:Vector2):
	Scanray.append([Seed])
	Rendray=[ ]
	Scan()

func Scan():
	var Newray:=[]
	var Setray:=[]

	for sort in Scanray.size():
		print(Scanray[0])
		if get_cell_source_id(0,Scanray[sort]) == 0:
			pass
			Setray.append(Scanray[sort])

The issue begins here →

	for sort in Setray.size():
		if not Rendray.has(Setray[sort]):
			Rendray.append(Setray[sort])
			Newray.append(get_surrounding_cells(Setray[sort]))

	if Newray.size()==0:
		pass
		print(Rendray)
	else:
		Scanray.clear()
		Scanray=Newray
		Scan()

you put your vector to an Array before appending it to Scanray:

with this, the Scanray has a bunch of Array inside Scanray Array

If you are trying to append an Array of Vectors as Vectors inside an Array, use this:
Scanray.append_array([Seed])

That did the trick! I modified the line where Newray is appended, and it started without a hitch. Much appreciated!