How to make a block disappear after a certain period of time
So I am making a 'magic trail', which is essentially wherever you walk and jump, a block will be placed below you. Unfortunately, the trail will always stick around and never go away. After a while this means that there will be a giant trail of blocks through the sky that looks pretty ugly. What I want to do is make a block disappear after a certain period of time, say, 7 seconds. Here are the commands and the setup for this project:
Command block #1: /setblock ~ ~ ~-1 redstone_block 0 destroy
Command block #2: /execute @a ~ ~ ~ /fill ~ ~-1 ~ ~ ~-1 ~ wool 0 replace air
Redstone block: []
#2
Setup: #1 []
Note: Please don't try a method using a FallingSandEntity and Age because I want to have the player be able to actually walk on the blocks. If you use a FallingSandEntity the player will fall right through the block. Anyways, all help is appreciated, thanks! Also, if you want to try doing this with the fill command, I would want a 7x7x7 hollow cube surrounding the player so that the trail can't go outside the blocks. I just don't know how to do this.
Best Answer
This will only work the PC edition, but you can place a command block with some sort of repeating signal. In 1.9+ just set the command to always active and repeat, and on 1.8- you can either take 2 hoppers into each other with a comparitor, or repeaters running into each other with 2 ticks delay.
However, the best thing to do, and what you may be already using, would be to have two command blocks constantly filling in an area with redstone blocks and stone to update the command blocks every tick.
So in the 1st command block put
/execute ~ ~ ~ detect ~ ~-1 ~ minecraft:air setblock ~ ~-1 ~ minecraft:[block to place]
Then in the next four command blocks put these commands to remove all of the blocks that where placed around the player
/execute ~ ~ ~ detect ~1 ~-1 ~ minecraft:[block to place] setblock ~1 ~-1 ~ minecraft:air
/execute ~ ~ ~ detect ~ ~-1 ~ minecraft:[block to place] setblock ~-1 ~-1 ~ minecraft:air
/execute ~ ~ ~ detect ~ ~-1 ~1 minecraft:[block to place] setblock ~ ~-1 ~1 minecraft:air
/execute ~ ~ ~ detect ~ ~-1 ~-1 minecraft:[block to place] setblock ~ ~-1 ~-1 minecraft:air
These may seem similar, but each one tests for and removes a different block around the player. For even greater success, create four more that remove the corner blocks around the player. This technique is good, as it only removes the blocks that have been previously placed.
Pictures about "How to make a block disappear after a certain period of time"



How do you make a block appear and disappear?
1 AnswerHow do you get rid of certain blocks in Minecraft?
Step One: Make selection by pressing X , moving to the other corner, and pressing X again. Step Two: Fill the selection with your selected item (in this case dirt) by pressing Z . Step Three: Remove all of your selected item (again dirt) in the selection with LSHIFT + Z .How to make a disappearing block in Roblox
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Samson Katt, Ketut Subiyanto, Monstera, Skylar Kang
