Create the visible area somewhere and clone it as invisible bedrock area and set the visible area 100 blocks bottom the invisible area (on the example).
Then place 7 blocks as a string somewhere; set 3 slow redstone repeaters on blocks 2, 4 and 6, and place impulse command blocks on blocks 3, 5 and 7.
Program Impulse command block on block 3 by the command:
/execute <player name> ~ ~ ~ teleport @p ~ ~-100 ~
Program the command block on the 5th block to:
/execute <player name> ~ ~ ~ teleport @p ~ ~+100 ~
Program the command block on 7th block by:
/setblock <cordinates of the top of the first block> air
Type to a repeating command block
/clear <player name> gold_nugget 0 1
And then connect it to a conditional chaincommand block with command:
/setblock <cordinates of the top of the first block> redstone_block
Set 3rd conditional chaincommand block on the chaincommand block on the repeating command block with command:
give <player name> gold_nugget 1 0
(And remember to give yourself the gold nugget, or it will not work for you, you need to do 2 of that command block creations to allow the trick for your friend too!)
(This example is from minecraft PE, I don't know, what version do you have, but I did what I can.)