Why doesn't my spike script work?

extends Node
@onready var character_body_2d: CharacterBody2D = $"../CharacterBody2D"
var playery
var playerx
 
 
func _on_body_entered(body: Node) -> void:
	print(body.name)
	if body.name == "CharacterBody2D":
		playerx = character_body_2d.position.x/1152
		playerx = ceil(playerx)
		playery = character_body_2d.position.y/648
		playery = ceil(playery)
		if playerx == 2 and playery == -2:
			character_body_2d.position.x = 1217
			character_body_2d.position.y = -447

This doesn’t work who knows why and I cant even check if playerx/playery are the right number because my print doesn’t work?

Have you connected this callable to a signal? Either through code or in the inspector?

I suggest you to look into how signals work in general, maybe this will spark some ideas for you on how to fix your issue:

Yea I have

Can you show how you connected?
And what are you doing to make the signal trigger?
You need to provide a bit more information if you want to have any meaningful answer.