1

I'm trying to make a game in Minecraft 1.16.5, and it has a shop. But since I am forced to use the /execute command I don't know how to make it so when you have 25 or more points, it subtracts 25 and unlocks it. Everything I found was from years ago, so they are out of date.

3
  • Possible duplicate of Finding a replacement for the scoreboard player test
    – pppery
    May 17, 2021 at 17:36
  • matches does not exist for some reason, and it isn't the same anyway.
    – anomanous
    May 17, 2021 at 18:08
  • @anomanous Then please make your question more specific. Why does /execute if score not satisfy you? Are you looking for a solution using target selectors? May 19, 2021 at 0:17

2 Answers 2

3

From the Minecraft Wiki:
"@e[scores={myscore=5..}] — Select all entities with a score in objective myscore of five or greater."
In your situation you will need at least two command blocks where the first will be a repeating command block detecting the entities with score higher or equal to 25 and removing the required points:

execute as @e[scores={scoreboard=25..}] run scoreboard players remove @s scoreboard 25

And the other command block has to be a conditional chain command block (has to be conditional so it only executes if the first one is executed successfully) and it is going to unlock the thing.
If you need to do some actions on the player that reached the score you will most likely need more command blocks and will need to use the target selector in each of the command blocks and remove the required score after all the commands targeting the player are done. Alternatively you could use another scoreboard or a team to identify the player.

1

You would use .. for min/max. For example, the following command will test for a score of 25 or more.
/execute if entity @p[scores={custom=25..}]
..25 would be 25 or less, and 1..25 would be 1 to 25.
To subtract 25 from the score, you would use remove.
/execute as @a[scores={custom=25..}] run scoreboard players remove @s custom 25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .