How to avoid team damage?

It’s a really simple question but I couldn’t find it by googling. Let’s say I’m making a multiplayer 4v4 team fps. How would I avoid damaging my own teammates? I considered putting an “enemy” tag on all enemies but since it’s multiplayer, I don’t think this will work.

EDIT: I have a new idea. What if I use layer-based collisions like so:

  • Team1 players and Team2 bullets on Layer1
  • Team1 bullets and Team2 players on Layer2

Does anyone see a problem with this?

4 vs 4 team player. Does your team has a name ? Set it as tag name for all 4 players.