Tile cannot be detected by player on layer

Godot Version

4.3

Question

Hello! Do anyone know how to fix players tile detection when stepped on a specific tile?

Problem

When the player stepps on a specific tile then its detecting the layer thats in under the specific tile’s layer. If i change the layer ID then it will be detecting “null”

Script

Layer 0 is the ground layer, layer 1 is the specific tile’s layer.
(I use classic tilemap)

func _on_area_2d_body_entered(body: Node2D) -> void:
	var tileCoords = conveyorTileMap.local_to_map(conveyorTileMap.to_local(position))
	var tiledata = conveyorTileMap.get_cell_source_id(1, tileCoords)
	print(tiledata)

I assume you want to use the areas global_position?

var tileCoords = conveyorTileMap.local_to_map(conveyorTileMap.to_local(global_position))

Also make sure this area is on top of the tile you want

Yea i used the global_position but it didint work either. The console is saying to the tileData -1(cannot detect tile source id) when its on the conveyor but if its on layer 0 it says 2(ground tileset source id).

can you use the calculated coordinates and replace the tile at this place. This way you see which tile is getting calculated

I cannot beacuse i am placing the conveyors in-game and i am rotating it so i dont think that can be working.