How to make enemy AI not be able to damage each other?

I’m guessing you are assigning the targets by looping through the list of pawns held by the AI Perception?

You need to assign the target status there. If you only want them to attack the player, loop through the list of perceived pawns, and Cast each one to Player Character (or whatever you have named it). This will only return true if the Perceived Actor is the player. Then you can assign that to be the Target.

Of course, you may also have accidentally flipped a Boolean check, so you may need to post your BP here.