Is there a way to make something happen only to players with a certain value?

Is there a way to make something happen only to players with a certain value? - 2 Men in Red and White Jersey Shirt Sitting on Grass Field

I'm setting up a loop that turns players into a certain block, but I only want certain people to be changed. Can anyone help?



Best Answer

To select players with a certain scoreboard value, use the score_[SCORENAME]=[MAX] and score_[SCORENAME]_min=[MIN] arguments in your entity selector. For example, to select people with a TurnToBlock score of at least 1:

@a[score_TurnToBlock_min=1]

You can use this in a command:

/say @a[score_TurnToBlock_min=1]

If by "certain value" you don't mean score values, then the wiki has a full list of other arguments can select players by:

Argument(s)     Selection criteria
x, y, z         coordinate
r, rm           radius (max, min)
m               game mode
c               count
l, lm           experience level (max, min)
score_name      max score
score_name_min  min score
team            team name
name            entity name
dx, dy, dz      volume dimensions
rx, rxm         vertical rotation (max, min)
ry, rym         horizontal rotation (max, min)
type            entity type

You can use these in the same way as above. For example, to only select players in creative:

/say @a[m=1]



Pictures about "Is there a way to make something happen only to players with a certain value?"

Is there a way to make something happen only to players with a certain value? - A Man Playing Tennis
Is there a way to make something happen only to players with a certain value? - Wooden Bridge on Rainforest
Is there a way to make something happen only to players with a certain value? - Road Between Pine Trees



How do you test a player in Minecraft in a certain area?

2. Type 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.




  • FIFA 22 How to Find Your Lost Players Ultimate Team




    More answers regarding is there a way to make something happen only to players with a certain value?

    Answer 2

    You can do it with teams. First create two teams by doing:

    /scoreboard teams add Block

    /scoreboard teams add NonBlock

    After doing so, using the clock that you have set up (I'm not completely sure how you did the command block clock so this might not work) change the specifier to:

    @a[team=Block]

    That should only target the players on the non block team. Oh, btw, you don't have to add the NonBlock team if commands aren't affecting them in the game.

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

    Images: Yogendra Singh, ramiz haider, Pixabay, veeterzy