Safe zone around spawn
Monsters that walk within 30 blocks of spawn disappear, and players inside the zone cannot be hurt.
You need
- 1 repeating command block
- 2 chain command blocks
- The coordinates of your spawn (the example uses 0 64 0)
1Protect the area
Replace 0 64 0 with your own coordinates in all three commands.
/kill @e[family=monster,x=0,y=64,z=0,r=30]Removes every hostile mob inside the radius.
/effect @a[x=0,y=64,z=0,r=30] resistance 2 255 truePlayers inside take no damage.
/effect @a[x=0,y=64,z=0,r=30] saturation 2 0 trueAnd do not get hungry.
No command blocks? Use the function pack
This creation is included in the free 9Minecraft Command Creations behavior pack. Add the pack to your world, then type one command. It does the same thing as the command blocks above, driven by a tick function.
/function n9/spawn_safe_zone_onTurns it on. All the setup commands from the steps above run for you.
/function n9/spawn_safe_zone_offTurns it off again.
How it works
Selector arguments x, y and z move the point that r is measured from, so the zone stays in place no matter where the command block is. The family=monster filter comes from the game data and covers zombies, skeletons, creepers and the rest in one word.
Make it your own
- Change r=30 to resize the zone.
- Use /tp @e[family=monster,x=0,y=64,z=0,r=30] ~ -100 ~ instead of kill if you do not want drops left behind.
- Add /title @a[x=0,y=64,z=0,r=30] actionbar §aSafe zone to tell players they are protected.
Turn it off
/gamerule commandblocksenabled falsePauses the command blocks.
Commands used
More command creations
Coins HUD above the hotbarShows each player their own coin balance above the hotbar at all times, using a scoreboard and titleraw.Easy HUD · 7 commands · videoIce bridge under your feetWater turns to ice in a 3 by 3 square under the player, so tagged players can walk across lakes and oceans.Easy Gameplay · 3 commandsJump pads and speed padsStep on an emerald block to be launched into the air, or on a gold block for a burst of speed.Easy Gameplay · 4 commandsLow gravity roomInside a box-shaped room, players jump high and float down slowly, like on the Moon.Easy Gameplay · 3 commandsMore from 9Minecraft
Command reference © 2026 9Minecraft.net. Syntax read from Minecraft Bedrock Edition 1.26.66.1.