Help with enemies not attacking when they should

Godot Version
4.3

I have a game where there are two castles. The enemy castle will spawn enemies and they will move towards your castle. Eventually(I haven’t gotten here yet) you will spawn troops out of your castle to fight the enemies. Both castles have HP and enemies should be able to attack both the castle and your troops. I have written code for castles to have health and take damage. I have also written a code for enemies to spawn. However my code for the enemy scenes for them to move towards the castle and attack when the castle is in their attack box area2d does not work. I have attached the codes for all of it as well as the game layout and node trees. I just need help as to why my enemies will walk right through the castle collisionbox without attacking

Here is the collision box code as well

Is it physically open? Print the target node on the first line of the attack function and run the game to see if there is output