Get all players that aren't on two teams?

Right now, I'm trying

@a[team=!admin,team=!checkpoint]

but it doesn't seem to be working... Any suggestions?

To clarify, I want all players that are not on the team 'admin' nor 'checkpoint'. I'm also trying to keep everything vanilla.


Solution 1:

You may only have one of each selector parameter, otherwise the last duplicate will be the one used (in your case, only players not in team checkpoint are targeted). What you can do is mark all players as being a viable targets first, and remove the mark from players in either of those teams.

1.8

Prerequisites:

Objective to mark the player as a viable target.

/scoreboard objectives add Target dummy

Clock commands:

The following must be run in numerical order on a clock.

  1. Mark all players as possible targets.

    /scoreboard players set @a Target 1
    
  2. Reset the Target score for players on team "admin" and "checkpoint".

    /scoreboard players reset @a[team=admin] Target
    /scoreboard players reset @a[team=checkpoint] Target
    
  3. Continue with the commands you want to run, targeting the Target score. Only players not on teams "admin" and "checkpoint" will have a score of 1.

    /say @a[score_Target_min=1]
    

1.9

The following must be run in numerical order on a clock.

  1. Mark all players as possible targets.

    /scoreboard players tag @a[tag=!target] add target
    
  2. Remove the target tag for players on team "admin" and "checkpoint".

    /scoreboard players tag @a[tag=target,team=admin] remove target
    /scoreboard players tag @a[tag=target,team=checkpoint] remove target
    
  3. Continue with the commands you want to run, targeting the target tag. Only players not on teams "admin" and "checkpoint" will have that tag.

    /say @a[tag=target]
    

Solution 2:

The selector @a[team=!admin,team=!checkpoint] is valid by itself in 1.13 and later versions of the game and does not need to be modified.