Minecraft: button that can only be used once?

I’m making a puzzle map with similar structure to Portal, where you get a cube and you put it on a button, etc. But for some puzzles, I want the block to be summoned by pushing a button, but I don’t want the command to work every time I push the button, only the first time so they get ONE block. Plus, if they lose the block, I’d like them to be able to get it again. How can I set this up to where your allowed to get only ONE block from this button?


There are a bunch of fancy ways to do this, but I would recommend the simplest one: Using /setblock to remove the button and later place it back whenever you want. That way the player immediately sees that they can't request another cube and won't try to push the button more often (because it's gone). And when the button is back again, they immediately see that they can request another cube. That's good user interface design. :)