Minecraft – How to get /testfor to only find one player with a score value

minecraft-commandsminecraft-java-edition

I set up a huge randomiser that gives you a random score on a scoreboard called 'say'. There is also a constant /testfor command running to detect a player with each of the possibilities of the randomiser, but no matter what, somebody is always being detected.

I used the command

testfor @p[score_say=13]  

(13 is one of the possibilities). I need help making it so that it doesn't always detect every player, but only the player with the score.

Best Answer

The score_[NAME] parameter checks only for maximum, while score_[NAME]_min checks for minimum. By only using maximum, you're checking for a score at 13 or lower, rather than exactly 13.

To check for an exact value, you'll need to include both maximum and minimum:

/testfor @p[score_say_min=13,score_say=13]
Related Topic