2

Im trying to make an minecraft map and i really need to check for an scoreboard, like, if your score is below a certain amount, it runs a certain command, but the less than(<) symbol doesn't seem to work. How should i do this? also, it should be in 1.16 please.

My command is:

/execute if score (player name) mana < 200 mana run setblock 6582 74 -266 minecraft:air

I'm making a mana system where I have a hopper clock adding 1 mana per second, when a certain player reaches 200 mana, a command spawns a redstone block to stop the hopper clock, it's all working fine, but the command to remove that block when there is less than 200 mana(to generate more via the hopper clock) doesn't seem to work.

New contributor
raidou kuzonoha is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • added the command and a explanation of what the system where it is in works, see if it helps. – raidou kuzonoha Jul 30 at 17:26
3

The operators <, <=, =, >=, and > are used to compare your score with another player's score.

execute if score Alice Kills > Bob Kills run tellraw @a {"text":"Alice is winning!"}

In your command, 200 is actually a player name:

execute
  if score XX mana < 200 mana           # If XX's `mana` score is less than `200`'s `mana` score...
run setblock 6582 74 -266 minecraft:air # then set a block.

To test for a certain number, use the matches keyword:

execute
  if score XX mana matches ..200        # If XX's `mana` score is equal to or less than 200...
run setblock 6582 74 -266 minecraft:air # then set a block.

Instead of using comparison operators, use ranges to specify allowed values.

  • 0: exactly 0
  • ..0: equal to or less than 0
  • 0..: equal to or greater than 0
  • 0..1: between 0 and 1 inclusive
  • 0.1..1.5: between 0.1 and 1.5 inclusive
  • ...1: equal to or less than .1. (.1 == 0.1)
  • 1...: equal to or greater than 1. (1. == 1.0)
| improve this answer | |
  • Thanks, man, really saved me there :) – raidou kuzonoha Jul 30 at 17:46

Your Answer

raidou kuzonoha is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.