Can I use inequality in command-block testfor arguments?

Can I use inequality in command-block testfor arguments? - Crop unrecognizable man cleaning computer system unit

I know there is the basic /testfor @a[score_HEALTH=1,team=red] but I need the "less than" argument.

How can I denote inequality, as in @a[score_health<20] instead of =20? when I do score_health<10 it just gives me an error.



Best Answer

As of Minecraft 1.13, score arguments are specified using ranges

selector[scores={OBJECTIVE=min..max}]

Therefore, to select all players with "health" scores less than 10, do @a[scores={health=..9}]




Pictures about "Can I use inequality in command-block testfor arguments?"

Can I use inequality in command-block testfor arguments? - Top view of phrase I Cant Breath on small black signboard with light beige thin frame on black background
Can I use inequality in command-block testfor arguments? - Tin vessels and metal bucket with milk placed near bike leaned on shabby rusty wall
Can I use inequality in command-block testfor arguments? - Man in Brown Hoodie Standing Near Road during Night Time



How do you Testfor with command blocks?

How to Enter the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.


  • What replaced the Testfor command in Minecraft?

    The /testfor command became obsolete in Minecraft 1.13, and has been replaced by the /execute command*. It will do the same as typing /testfor @e {SelectedItem:{id:"<item>"}} and then putting a comparator to the command block with the command, and then running the command which you wanna run.

    How do you use command blocks with conditional?

    "Conditional": A command block in conditional mode will only execute its command after the command block behind it has executed successfully. ("behind it" in the sense of opposite to the direction the command block is facing, regardless of chain direction or even if chaining is occurring).

    What does @R mean in Minecraft?

    The other target selectors are \u201c@a\u201d for all players, \u201c@r\u201d for a random player, and \u201c@e\u201d will target all entities. Entities include everything that isn't a block, like monsters, snowballs, animals, and arrows.



    What do all these arguments do and mean?? | Minecraft PE commands




    More answers regarding can I use inequality in command-block testfor arguments?

    Answer 2

    OK I'm so happy but thanks to AoElite i found the answer. here it is. /testfor @a[score_health_min=3,score_health=9] modify that and you have the ultimate minecraft team respawn/death command for command blocks.

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Anete Lusina, Brett Sayles, Plato Terentev, Anh Tuan