TransWikia.com

How to combine target selector arguments with OR, not AND?

Arqade Asked on December 12, 2020

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?

One Answer

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".

Correct answer by Fabian Röling on December 12, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP