When i try too touch the area2d with the player it doesnt work i have connected the area2d with a script but it doesnt work but when i try the other ones like the enemy it works and the code works (sorry my english is really bad and im a noob) heres the whole script

extends KinematicBody2D

var movespeed = 600
var bullet_speed = 2000
var bullet = preload("res://Bullet.tscn")
var teleport = true

func _physics_process(delta):
	var motion = Vector2()
	
	if Input.is_action_pressed("up"):
		motion.y -= 1 
	if Input.is_action_pressed("down"):
		motion.y += 1 
	if Input.is_action_pressed("right"):
		motion.x += 1 
	if Input.is_action_pressed("left"):
		motion.x -= 1 
	
	motion = motion.normalized()
	motion = move_and_slide(motion * movespeed)
	look_at(get_global_mouse_position())

	if Input.is_action_just_pressed("click"):
		fire()
		$Sprite/ShootSound.play()
		
	if Input.is_action_just_pressed("right_click") and teleport == true:
		position = get_global_mouse_position()
		teleport = false
		$Sprite/TeleportSound.play()

func fire():
	var bullet_instance = bullet.instance()
	bullet_instance.position = get_global_position()
	bullet_instance.rotation_degrees = rotation_degrees
	bullet_instance.apply_impulse(Vector2(),Vector2(bullet_speed,0).rotated(rotation))
	get_tree().get_root().call_deferred("add_child",bullet_instance)
	

func kill():
	get_tree().reload_current_scene()

func _on_Area2D_body_entered(body):
	if "Enemy" in body.name:		
		kill()

func _on_TeleportKey_body_entered(body):
	if "Player" in body.name:
		print("hello")

i dont know what to do i would thank you if i get a little help cause ive been on this for hours! thanks :)

Try printing out more diagnostic information:

func _on_Area2D_body_entered(body):
    print("%s._on_Area2D_body_entered, body=%s, body.name=%s" % [name, body, body.name])
    if "Enemy" in body.name:        
        kill()

oh i meant the func _on_TeleportKey_body_entered(body): if "Player" in body.name: print("hello") but when i try the print("%s._on_TeleportKey_body_entered, body=%s, body.name=%s" % [name, body, body.name]) it doesnt print anything when i touch it with the player and ive made sure that its exactly the name of the player and when i remove the if "Player" in body.name: it doesnt print too

I'd also check to make sure the signals are correctly connected in the Godot editor, or add connect the signals via code using the connect function.

@Zelta said: check layers and masks Thanks so much!! it worked i had the layers and mask on 0 on the player i changed it and now it works thanks! :+1:

@TwistedTwigleg said: I'd also check to make sure the signals are correctly connected in the Godot editor, or add connect the signals via code using the connect function.

i checked that but now i fixed it, it was the layers and masks thanks anyways for answering :grin: t

a year later