Command block

Minecraft Execute Command Generator

Most broken commands are broken selectors, not broken syntax. Build the /execute if entity condition here with explicit filters, and test it with a harmless command before wiring it to something that damages, kills or teleports.

  • type, tag, team, scores, distance and nbt filters
  • limit and sort to control how many entities match
  • Composable with run, store and the positional subcommands

Read the matching guide

FAQ

How do I run a command only if an entity exists?

/execute if entity <selector> run <command> executes the trailing command only when the selector matches at least one entity. Build the selector filters here and test with a harmless command before wiring it to something destructive.

Why does my /execute condition never match?

Most broken commands are broken selectors, not broken syntax -- a wrong type, tag, or distance filter. Narrow the selector step by step, and remember distance and coordinates are relative to the execution position, not the command block.

What is the difference between if and unless?

if entity runs when the selector matches; unless entity runs when it does not. Swapping the two is a common logic bug when building conditional command chains.