This question is an exact duplicate of:
While I was playing with some redstone tried to make a money system to sell iron. However when I power the command block with a button, the comparator after it stays on.
the command being run is:
/clear @p minecraft:iron_ingot 0 5
and then a comparator leads to:
/scoreboard players add @p Dollars 10
So how do I turn off the comparator?