how to specify a body for body_entered signal

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

I used this code in the signal of area2d, body_entered(node: body)
I don’t know why it doesn’t work, please help. It says "non exsitent function “get name” in base “Nil”.

func _on_potion_body_entered(body : KinematicBody2D):
if (body.get_name() == "blue"):
	Global.blue_tele = true

elif (body.get_name() == "yellow"):
	Global.yellow_tele = true
:bust_in_silhouette: Reply From: lofi

it seems like it doesn’t recognize a body entered, try this:

func _on_potion_body_entered(body):
    do stuff....