How would I make a commandblock do setblock at a certain player

I was using setblock a lot and playing around with it, until I came with the idea, what if I could use setblock to make a game like Runner, from Mineplex, to make the blocks disappear when they run over it? What command block setup would I use? I was thinking about a testfor command which sends a signal when they are standing at the certain area {x=10,y=5,z=20} and if the player stood on that block the testfor command should be sending a signal to another commandblock which does the following command: setblock 10 5 20 air, but what if the signal wouldn't be fast enough, for example, when someone has speed II, how would I make a game like this then? Would it be more complicate, or harder to setup, would it take more commandblocks, a faster clock, what would it take?


Solution 1:

When they run over the "start" pressure plates have a scoreboard objective set

/scoreboard players set @p <objective name> 1

And have a clock running all the time doing this command

/execute @p[score_<objective name>_min=1] ~ ~-1 ~ setblock ~ ~ ~ air

The execute @p[score__min=1] means "Do this command relative to @p with a score of one in that objective" And the setblock sets the block under the player to air.

Hopefully this answers your question.

Solution 2:

Minecraft has 20 ticks 1 tick is 0,05 seconds you can build a 20hz clock by set a commandblock with the command setblock ~ ~1 ~ air and a 2nd commandblock two blocks over the 1st with the command setblock ~ ~ -1 ~ redstone_block then put a redstoneblock in the middle of the commandblocks and put a 3rd commandblock on the redstoneblock with the command execute @a[m=2] ~ ~ ~ setblock ~ ~-1 ~ air 0 destroy / replace