Minecraft – Setblock clock with scoreboard doesn’t work in Minecraft

minecraft-commandsminecraft-java-edition

I've been trying some things with scoreboard lately and I always get to the point where I need to use the following commands.

/scoreboard players set @a Holding 0
/scoreboard players set @a Holding 1 {DataTag}
/execute @e[score_Holding_min=1] ~ ~ ~ /summon LightningBolt ~ ~ ~

People tell me to connect these to the same setblock clock but in order. I do that this way.

But nothing happens. The problem seems that the Holding score is set back to 0 too fast for the execute command to work. Does anyone know how to make this setup work?

Best Answer

Your command blocks are placed in the wrong order in the world.

When multiple command blocks are powered at the same time, they are executed in the direction of +X, +Y and +Z. It is very likely that your line of redstone "points" in the -X or -Z direction, thus making the game run the commands in reverse order:

/execute @e[score_Holding_min=1] ~ ~ ~ /summon LightningBolt ~ ~ ~
/scoreboard players set @a Holding 1 {DataTag}
/scoreboard players set @a Holding 0

This leaves every players Holding score at 0 at when the execute command is run, therefore it does not execute properly.


In 1.9+, chain command blocks should be used to easily prevent such issues.