TransWikia.com

Why do the less than() symbols don't work?

Arqade Asked by raidou kuzonoha on February 19, 2021

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.

One Answer

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)

Correct answer by ExpertCoder14 on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP