# Add exchg3 tag for players within distance with 10 coins minimum execute as @a[distance=..5] run execute store result score @s tokenCount run clear @s minecraft:sunflower{ctcb:"certified"} 0 execute as @a[distance=..5] run execute if score @s tokenCount matches 1.. run tag @s add exchg3 # Save scores on monetary and player itself execute as @a[tag=exchg3] run scoreboard players remove @e[type=minecraft:armor_stand,tag=monetary] tokenCirculation 1 # Clear coins and give diamond execute as @a[tag=exchg3] run clear @s minecraft:sunflower{ctcb:"certified"} 1 give @a[tag=exchg3] minecraft:spore_blossom 1 # Notify using tellraw of the results tellraw @a[tag=exchg3] ["",{"text":"Spore Exchange >> ","bold":true,"color":"dark_green"},{"text":"Exchanged 1 CraftyCoin for 1 spore blossom.","color":"white"}] tellraw @a[distance=..5,tag=!exchg3] ["",{"text":"Spore Exchange >> ","bold":true,"color":"dark_green"},{"text":"Could not exchange. ","bold":true,"color":"dark_red"},{"text":"Not enough CraftyCoins in your inventory.","color":"white"}] # Remove exchange tag tag @a[tag=exchg3] remove exchg3