node-less script problem

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kietjay123

Hi, i have a node-less script extend area2d and attached it to multiple area2d node in my game, the code is to see if the area colide with a body with difference parent node it will hide the node that the area2d node is attched to

extends Area2D





func _ready():
# warning-ignore:return_value_discarded
	self.connect("body_entered", self, "body_entered")




func body_entered(x):
	var a = x.get_parent().get_parent().get_name()
	if a != "map" :
		x.get_parent().hide()
		print(x.get_parent().get_parent().get_name())

but it doesnt seem to work, putting a break into the code show that a is “map”
but the condition in the signal still run anyway enter image description here
pls help