How do I set a /kill command on a block?
You can set a /kill command on a command block, I know that, but how do I do it? I am making a map, so please help!
Best Answer
This is pretty lacking in detail, so I'll give you an overview.
First off, you need a command block (Directly from the wiki):
Command blocks can be obtained by using the pick block control or with various commands, such as
/give <player> minecraft:command_block <amount>.Command blocks are not available in the creative inventory, cannot be broken in survival mode or if you do not have operator permissions (1.9[upcoming]), are not flammable, and have the same blast resistance as bedrock. Command blocks cannot be moved by a piston.
Then enter your desired kill command into the command block, e.g.
/kill Namewhere "Name" is a players name, will kill that player/kill @eTo kill everything/kill @e[type=Sheep]To kill all sheep/kill @e[type=!Player]Will kill anything which isn't a player (Including de-spawning dropped items)
You then activate the command block in a normal way, the easiest of which is either directly from a switch/lever, or a redstone current.
Pictures about "How do I set a /kill command on a block?"



Quick Answer about "How do I set a /kill command on a block?"
How do you make a command block kill everything?
Kill Command In all Minecraft editions, the command for killing everything in the world is \u201c /kill <target> \u201d. Typing \u201c /kill \u201d any target in the console will destroy pretty much everything that can be removed, including the player.How do you execute a command at a block?
How to get a Command BlockHow do you use the kill entity command?
Typing just /kill will kill every entity in a loaded area, including your armor, stands, minecarts, and even your own player. To prevent killing your own player, make sure to limit the command from killing yourself as well. For example, /kill @e[type=! player] will kill every entity except for your own player.Using Commands in Minecraft: /kill and an Introduction to Position Selectors | 1.11.2
More answers regarding how do I set a /kill command on a block?
Answer 2
You can't exactly /kill a block (at least I don't think), as blocks are notentities. However there are some exceptions including Item Frames and Minecarts. What you can do as an alternative is /setblock x y z air for example, to set a block to air (basically removing it completely).
With Item Frames, you can do /kill @e[type=ItemFrame]. Same with minecarts (just making the ItemFrame into a MinecartRidable
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Matthias Groeneveld, Ketut Subiyanto, Teona Swift, Ketut Subiyanto
