Minecraft – How to set a dumthe scoreboard objective to another dumthe

minecraft-commandsminecraft-java-edition

I'm trying to make a couple of command blocks that are capable of emitting a redstone signal whenever the player jumps. I thought I would do it by constantly checking whether the Jump objective was the same as a dummy objective which always changes itself to the Jump objective.

To get to the point I need to set a dummy scoreboard objective called OldTotalJumps to an scoreboard objective which I've named TotalJumps. I have tried: scoreboard players set OldTotalJumps TotalJumps but it keeps coming up with the error: "TotalJumps is not a valid number".
I hope someone can help.

Best Answer

There is a better way of solving your problem. Instead of creating a new dummy objective, you can simply reset the jumps objective to 0 every tick.

You would need to run the following command once:

/scoreboard objectives add jumps stat.jump

And these on a clock:

/execute @a[score_jumps_min=1] ~ ~ ~ do stuff
/scoreboard players set @a[score_jumps_min=1] jumps 0

Of course you replace do stuff with the command/function you actually want to run.

 

If you're still interested in solving the exact problem you posed, there is a different /scoreboard 'subcommand' that can do that: operation. The following command sets the command executor's oldtotaljumps score to its totaljumps score.

/scoreboard players operation @s oldtotaljumps = @s totaljumps