Minecraft java command block reply "you don't have enough money"
I'm making a Minecraft virtual market and, here are my commands for command blocks.
First command block: Impulse, Unconditional, Needs Redstone
/tellraw @p {"text":"Succesfully purchase an item","color":"gree n"}
Second command block: Chain, Unconditional, Always Active
/scoreboard players remove @p[distance=..7,scores={money=100..}] money 100
Third command block: Chain, Unconditional, Always Active
/give @p minecraft:golden_apple 1
How do I make another command such that when you run out of money it says say "you don't have enough Money".
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 /tellraw
s 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.