Messed up somewhere in detecting Area2d entered1

The version I use is Godot 4.2.

Hey there! I’m trying to connect area2D entered through code. The idea is to connect hit box(an area2D) to attack state, when player is on attack state. Right now, it is connecting but it is not triggering the function, the debugger didn’t find any mistakes. I first thought the issue might be with layers and z index, but apparently enemy can detect player.

Screenshot 2026-10-27 213419

This is the code. Thanks in advance!

Is your player an Area2D or a CharacterBody2D? area_entered will only detect other Area2D nodes, maybe you mean to use body_entered?

Also the function argument func _on_area_entered(Area2D) -> void: matches the type Area2D, you should avoid this by naming the argument something else like area, maybe you meant to give it the type of Area2D with a colon, like so

func _on_area_entered(area: Area2D) -> void:

Paste code, not screenshots please

My player is a characterbody2D, and the hitbox(a child of the player) is an Area2D. I want the attack state to detect through the area entered signal of hit box, when a hurtbox(an area2D) enters.

How do you know it’s connecting but not triggering the function?
What function are you talking about?

print("area entered is connecting") 

The above line of code is below the if statement which connect the area2d entered function. I get this string printed in my console when ever I hit attack state. But yeah, I can’t say for sure! But how can I confirm it?