Minecraft – scoreboard specification

minecraft-commandsminecraft-java-edition

Im in need for a way to detect if a scoreboard is set to 0 ,1 ,2 ,3 ,or 4
And give the person that has that scoreboard certain items like, an enchanted diamond pickaxe or jump boost 2. Im playing MC 1.9.2. I also only want to use commands and redstone.

Best Answer

Create a scorboard: (replace testBoard with a name for the scoreboard)

/scoreboard objectives add testBoard dummy

Set a value:

/scoreboard players set PLAYER_NAME testBoard 1

Testfor players with values:

1. Effect (Replace the 1 with whatever score you want to test for)

PUT THIS INTO A REPEATING COMMAND BLOCK

/effect @a[score_testBoard=1,score_testBoard_min=1] minecraft:jump_boost DURATION LEVEL

For example:

/effect @a[score_testBoard=1,score_testBoard_min=1] minecraft:jump_boost 1 2

2. Give items (Replace the 1 with whatever score you want to test for)

/give @a[score_testBoard=1,score_testBoard_min=1] minecraft:dirt

If you want to give the item only once:

  • Put the command into a repeating command block
  • Add another repeating command block with the following command: (Replace the 1 with whatever score you want to test for)

/scoreboard players reset @a[score_testBoard=1,score_testBoard_min=1] testBoard

Then reset the value of an player:

/scoreboard players reset PLAYER_NAME testBoard

Hope it helped :)