Can't draw on tilemap with script

Godot Version

4.7.1

Question

var buf: Array[Vector2i]


func paint(tilemap: TileMapLayer, cells: Array[Vector2i]):
	var terrain_set = 0
	var terrain = 0
	tilemap.set_cells_terrain_connect(cells, terrain_set, terrain, true)


func _ready() -> void:
	for i in range(40):
		buf.append(Vector2i(i, 2))
	
	paint($TileMapLayer, buf)

for reference doing this works

func paint(tilemap: TileMapLayer, cells: Array[Vector2i]):
	for cell in cells:
		tilemap.set_cell(cell, 0, Vector2i(1, 1))


func _ready() -> void:
	for i in range(40):
		buf.append(Vector2i(i, 2))
	
	paint($TileMapLayer, buf)

balrightsorry for making this post ig I was playing around and found out making the parameter ignore_empty_terrains be equal to false works :+1: