Check if Transform Tags are Identical

Hey, so I was wondering if it was possible to check on hit (RayHit) if the hit objects transform tag is equal to that of the player? Or even better: If the hit object is the player. In context, I don’t want the player to receive the full damage of an explosion or shot when he is hit by his own weapons or those of friendlies. Can anyone help me? Thank you in advance!

Okay so what I ended up doing is the following:

I added Tags for to the players for Teams and gave the Players names and used the following Code:

if(Hit.transform.gameObject.name == "Player1")