Minecraft – How to make a commandblock do setblock at a certain player

minecraft-commandsminecraft-java-edition

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?

Best Answer

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.