My player Hit twice the enemy

As there are 2 box colliders on the enemy, then it is hit twice by an attack, is there any way to fix it? Also my enemy doesn’t move linearly but moves by bouncing. I’ve been checking my code for hours and trying to fix it but it’s impossible, I appreciate any kind of help.

the link to my project is: GitHub - Jiyo101/Metroidvania: Metroidvania