Minecraft – Setting score to moving variable

minecraft-commandsminecraft-java-edition

I'm trying to make a contraption that will set a players score to another score, then raise the 2nd score so that the next player to do the action will have the same as the first player +1.

My command so far is:

/scoreboard players set @a[r=3,score_RoomID_min=0,score_RoomID=0] RoomID

I need to add something to the end that can set the RoomID score to Rooms, then have a separate command blocks adding 1 to Rooms.

Best Answer

To set the "RoomID" score equal to "Rooms" you would do this:

scoreboard players operation <player> RoomID = <player> Rooms

with <player> being a player either by username, target selector or *, to select all players.

To add one to the "Rooms" score you would do this:

scoreboard players add <player> Rooms 1

Again, <player> being a player either by username, target selector or *, to select all players.