How do I do a /setblock for under a player?
I'm trying to make a vanilla spleef arena, with a redstone clock attached to a /setblock command. No matter how I tried, I could not get the command to set the block under the player air. this was the closest I got: /setblock ~ ~-1 ~ air is there some way I can attach the ~ ~-1 ~ to @p? If not what is another way to do this?
Best Answer
What you are looking for is the amazing execute command:
Executes a command on behalf of one or more other entities, with originating permissions, optionally on condition that a single-block /testforblock-style check passes.
The syntax is:
execute <entity> <x> <y> <z> <command …>
<entity> is a target selector, such as @a, <x> <y> <z> are coordinates from which to execute the following <command …> from. In most cases, setting this to ~ ~ ~ (i.e. the exact location of the entity) is fine. To set the block under every player to air, you can use
execute @a ~ ~ ~ setblock ~ ~-1 ~ air
Pictures about "How do I do a /setblock for under a player?"



What is the command for Setblock in Minecraft?
To fill an area relative to the player, put the following code into a command block or your chat: /execute @<p,a,r,e> <x> <y> <z> /fill <x1> <y1> <z1> <x2> <y2> <z2> <block> 0 replace <blocktoreplace> .How to make blocks under the player command minecraft
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Brett Jordan, Yan Krukov, Yan Krukov, Brett Jordan
