When multiple target selector arguments are listed, it selects a player who only meets all the criteria listed in the target selector.

How can I make it so that the target selector is valid if at least one condition is true, not all of them?

2 Answers 2


You cannot do that. You have two options:

  1. Have one command per possibility.

  2. Invert the check and the arguments (not always applicable):

    /execute unless @s[tag=!a,tag=!b,tag=!c] run […]

That command runs if you have either tag a or tag b or tag c, because it says "do not run this if I do not have a and do not have b and do not have c, otherwise run it".

  • Firstly, you can't for example do if(a&&b||c), secondly this doesn't work if you need it in at or facing or anything else in which the as reference needs to stay on something else. Commented May 28, 2020 at 8:05

I found you can sometimes manage this by inverting the check, using tags.

[edit: my example wasn't accurate, so I've removed it and trying to just describe the technique]

You can use tags, and De Morgan's Law :

A OR B = !((!A) AND (!B))

So if tag everyone in the game who meets condition A, and then everyone in the game who meets condition B, you can then test and tag for the combination.

For example, I tagged everyone in the game holding an apple with two command blocks on repeat:

/execute as @a[tag=!apple,hasitem={item=apple,location=slot.weapon.mainhand}]
 run tag @s add apple


/execute as @a[tag=apple,hasitem={item=apple,location=slot.weapon.mainhand,quantity=0}]
 run tag @s remove apple

then do the same for holding a torch.

Then if I wanted to tag anyone holding an apple OR a torch, I could use another tag and another pair of command blocks

// chain
/execute as @a[tag=no_apple_no_torch] run tag @s remove no_apple_and_no_torch
// then
/execute as @a[tag=!apple,tag=!torch] run tag @s add no_apple_and_no_torch

Then all players not tagged no_apple_and_no_torch have either an apple OR a torch.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .