How do I detect two different teams in the same area?

Trying to recreate Zedaf's Proximity map in 1.13, but ran in the problem of making opposing team members visible on the same island. First, I thought to make an execute unless command

/execute unless @a[team=blue,team=red,x=-200,y=30,z=-600,distance=..10] run effect give @a[team=blue]

together with

/execute unless @a[team=blue,team=red,x=-200,y=30,z=-600,distance=..10] run effect give @a[team=red]

but that would be detecting someone on both teams. The main question is how do I make it where if two separate teams are in the same are in the same area then no more invisibility for the people in that area alone, but if only one team is present then they remain invisible.

I can only find answers with the testfor function which does not exist in 1.13.


You need a command like this:

/execute at @e[team=blue] run effect clear @e[team=red,distance=..10] invisibility

The execute part moves the command execution point to every member of team blue. The effect clear part after it is then limited to only members of team red in a radius around these blue players. So only blue players who are close to red players become visible.