Tiles changing is severely offset from where the player actually is, despite changing it relatively to the player's position

Godot Version

4

Question

Here is my code, how can i fix what is going on? im very new to GDScript

extends TileMap

var ply : Node = get_parent()

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	if (ply):
		set_cell(0,ply.position,0,Vector2i(2,0),0)
		print(ply.name)
		print(ply.position)
	else:
		ply = get_parent()
		ply = ply.get_child(0)
	pass

What’s you node structure look like?

image

the player is a scene with a sprite and collision 2d within it

Try set_cell(0, ply.global_position ,0 , Vector2i(2,0), 0)

yeah i tried taking its global position before because i thought that was the problem but it didnt change anything

Edit: here is a clip of what is happening for better understanding of my problem since i know just the title is limiting
w5d29hOK-ezgif.com-optimize