Skip to main content
Came around for some general cleanup and housekeeping.
Source Link
One 2 Many
  • 12.8k
  • 9
  • 52
  • 91

Use /execute if score:

execute if score @p money matches ..99 run tellraw @p "currency deficiency"
execute if score @p money matches 100.. run tellraw @p "purchase made"

Replace the /tellraws with whatever you need to make your machine work.

I also see that ifIf you have enough money, you're probably going to want to run multiple commands if the condition passes. YourThe best way to do this would be to use a data pack and set up a function.

Alternatively, you can either have one checkcommand per step:

execute if score @p money matches 100.. run tellraw @p "purchase made"
execute if score @p money matches 100.. run scoreboard players remove @p money 100

Or you can setup a functionbut I do not recommend this, especially if the number of steps increases.

Use /execute if score:

execute if score @p money matches ..99 run tellraw @p "currency deficiency"
execute if score @p money matches 100.. run tellraw @p "purchase made"

Replace the /tellraws with whatever you need to make your machine work.

I also see that if you have enough money, you're going to want to run multiple commands if the condition passes. Your can either have one check per step:

execute if score @p money matches 100.. run tellraw @p "purchase made"
execute if score @p money matches 100.. run scoreboard players remove @p money 100

Or you can setup a function.

Use /execute if score:

execute if score @p money matches ..99 run tellraw @p "currency deficiency"
execute if score @p money matches 100.. run tellraw @p "purchase made"

Replace the /tellraws with whatever you need to make your machine work.

If you have enough money, you're probably going to want to run multiple commands if the condition passes. The best way to do this would be to use a data pack and set up a function.

Alternatively, you can have one command per step:

execute if score @p money matches 100.. run tellraw @p "purchase made"
execute if score @p money matches 100.. run scoreboard players remove @p money 100

but I do not recommend this, especially if the number of steps increases.

Source Link
One 2 Many
  • 12.8k
  • 9
  • 52
  • 91

Use /execute if score:

execute if score @p money matches ..99 run tellraw @p "currency deficiency"
execute if score @p money matches 100.. run tellraw @p "purchase made"

Replace the /tellraws with whatever you need to make your machine work.

I also see that if you have enough money, you're going to want to run multiple commands if the condition passes. Your can either have one check per step:

execute if score @p money matches 100.. run tellraw @p "purchase made"
execute if score @p money matches 100.. run scoreboard players remove @p money 100

Or you can setup a function.