I don't know what type of variable i should put here

Godot Version

4.1.2

Question

So when I try to change “tileXY” variable it shows an error, i dont know how I can fix this beacose eveytime this button is pressed, game crushes.

(This function is in player’s script)

func _on_button_pressed():
$Camera2D/Control/Node2D.tileXY = Vector2(3,0)

(this is tile map’s script)
extends TileMap
var tileXY : Vector2i = Vector2i(0, 0)
func _process(delta):
# remove a tile when lmb pressed
if (Input.is_action_pressed(“lmb”)):
var tile : Vector2 = local_to_map(get_global_mouse_position())
set_cell(1, tile)

# Add a tile when rmb pressed
if (Input.is_action_pressed("rmb")):
	var tile : Vector2 = local_to_map(get_global_mouse_position())
	set_cell(1, tile, 0, Vector2i(tileXY))

Could you post the error(s) you’re getting?

in this line you’re passing a Vector2i inside a Vector2i, which will probably throw one. Since tileXY is already a Vector2i you can try this instead:
set_cell(1, tile, 0, tileXY)