Minecraft /clear command clearing inexistent blocks
I’m on Minecraft PE and I’ve been trying to make a shop that takes diamonds and gives items. I have 2 command blocks set up, the first on impulse and the second on conditional chain, so the second block (the one that gives the item) only executes if the first block (the one that takes the diamonds) is successful. The problem I have is that I try to take 5 diamonds, but the block will work even with 1 diamond and still gives the items. How do I fix this?
/clear @p diamond 0 5
/give @p apple 1
If you want a secure shop system, you should not use command blocks but rather build a redstone contraption like silentwhisperer's one. You can entrap it with bedrock, barrier blocks or blocks on deny blocks to make in unbreakable in survival.