Minecraft – How to use a score in a different command in Minecraft

minecraft-commandsminecraft-java-edition

I am making a game where a player has a score that goes up every second by a different stat. That stat is their score on a specific scoreboard. How do I do this?

For Example,
If their score for the stat is 26, every second a their other score goes up by 26

Thanks

P.S. Also, can I make that score be the name for an armor stand?

Best Answer

For Example, If their score for the stat is 26, every second a their other score goes up by 26

I'll use MainScore for "their other score", and Increment for "score for the stat".


The command you want is:

/execute @a ~ ~ ~ /scoreboard players operation @a[c=1] MainScore += @a[c=1] Increment

This makes each player add their Increment to their MainScore.