
scoreboard players operation money_check b = money_count b

execute if score money_check b matches ..7776 run scoreboard players set buy_2 b 3
execute if score money_check b matches 7777.. run scoreboard players set buy_2 b 2

execute if score buy_2 b matches 2 run replaceitem entity @a[hasitem={item=c:machine,quantity=0}] slot.hotbar 3 c:machine 1 0 {"minecraft:item_lock":{"mode":"lock_in_inventory"}}
execute if score buy_2 b matches 2 run scoreboard players remove money_count b 7777
execute if score buy_2 b matches 2 run playsound c.money @a
execute if score buy_2 b matches 2 unless score plan_7 b matches 2 run scoreboard players set plan_7 b 1