Can I use inequality in command-block testfor arguments?

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.


The way you test for a score is to use = and min=. For example, /testfor @a[score_health=20] will testfor all players who's health is 20 or below. /testfor @a[score_health_min=8] will testfor all players who's health is 8 or more. To test if a player has 3 to 9 health you can do /testfor @a[score_health_min=3,score_health=9]. I hope this helps!

Links: http://minecraft.gamepedia.com/Scoreboard


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}]