How to use a box collider to stop raycast (tracing)

Im am part of a group that is making a game where you attack and defend based off of the enemy’s animation (if the enemy is doing an attack animation you must defend so that you wont lose damage.) The characters use raycasting (tracing) to apply damage. My question is what settings would I use on the player character’s box collider to stop the raycast from hitting the player character? Every settings I have tried still lets the raytrace through the collider and hurt the player.

You would want to setup a new Object Response Channel then do a trace by Objects with that new Object type selected. Then on all your collusion boxes make sure to have that Object Response Channel set to block. You make new Channels via Edit Menu → Project Settings → Collision.

See: Collision in Unreal Engine | Unreal Engine 5.2 Documentation

would it be possible if you showed me in blueprint i have most of it in my game but im stuck with how it is in the blueprint. If you could that would be a major help.

Nevermind i got it working! thank you so much ive been struggling with that for a couple days!!!