Minecraft – How to set scoreboard of the player to ‘N’ if the current score is ‘n’? (Minecraft)

minecraft-commandsminecraft-java-edition

I am trying to set a scoreboard to track the players' progress through my map with a scoreboard but I don't want it to continue counting up if the player plays the same part multiple times.

The command I tried is this:

execute if score @p levelcopmlete matches ..1 run scoreboard players add @p levelcopmlete 1 From what I Could see is the first part was not working, although it did work for a while before not working. I didn't change anything in between either.

I also tried:

execute if score @p levelcopmlete > 1 run scoreboard players add @p levelcopmlete 1

execute if score @p levelcopmlete >= 0 run scoreboard players add @p levelcopmlete 1

I started with the bottom one and when it stoped working I tried the other 2.

Best Answer

I figured out you can use this command: execute if score @p levelcopmlete matches ..0 run scoreboard players set @p levelcopmlete 1