On multiplayer in Minecraft, I am trying to detect when a player changes their score using /trigger. Here's an example scenario:

I create a new objective called "test." Then, I use /scoreboard players enable @a test, which lets everyone modify the objective. After which, I have a /tellraw command used on all players giving them four options to click. Each option corresponds to a different score the player gives themselves. For example, clicking on "test one" would make the player run /trigger test set 1, clicking on "test two" would make them run /trigger test set 2, and so on.

How would I be able to detect when a player set their objective to a specific number score, such as 3?

1 Answer 1


You can use scoreboard in player selectors to find out which one they clicked. Usually this is done by either testfor or execute.

I recommend a 20 t/s clock to check these as soon as they click it. You don't have to use one, but it may help. great method to setup one.

In the case of testfor, it is actually not recommended to use it. You can't exactly distinguish which player clicked it, you just know that it was clicked. A better way is the execute method. Never-the-less, the command should look like this:

Testfor @a[score_test=1,score_test_min=1]

You will need a comparator to get if it succeeded to find it. You should also have a separate command block for each, then change the 1 to another number for each possible outcome.

In the case of execute: recommended method. You can use @p in the command part to target that specific player. Command as follows:

Execute @a[score_test=1,score_test_min=1] ~ ~ ~ <command>

For this, you should set their score of that to 0 as soon as the command is run, otherwise that command may be run twice.

  • Another problem with the testfor method is that this is a multiplayer server, so the comparator would not be able to detect many clicks at once. My question is, does /execute even allow non-op players to use commands that require op? Aug 28, 2015 at 21:46
  • @Draconwolver sorry, I mean that the command need to be in a command block. The trigger command will change the score, this command only detects it and runs a command when someone clicks it.
    – Judge2020
    Aug 28, 2015 at 21:55
  • Sorry, I don't think I'm wording this correctly. What I mean to ask is, if you run /execute in a command block like you're saying, will the command you put in be run as OP? Aug 28, 2015 at 21:57
  • @Draconwolver oh, ok. It is actually run at the server-level, which is above OP. It can do everything OP can. The only thing command blocks can't do is use the commands KICK and OP.
    – Judge2020
    Aug 28, 2015 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .