Bedrock target selectors
A target selector picks who a command applies to. It is a variable such as @a, followed by optional arguments in square brackets that narrow the choice.
Selector variables
| Variable | Selects |
|---|---|
@p | The nearest player to where the command runs. |
@a | Every player, including dead ones. |
@r | One random player. Add type= to pick a random entity of that type instead. |
@e | Every loaded entity: players, mobs, items, projectiles. |
@s | The entity running the command. |
@initiator | The player who is talking to an NPC. Only works inside NPC dialogue commands. |
Selector arguments
Arguments go inside square brackets, separated by commas, with no spaces: @e[type=zombie,r=10,c=3].
| Argument | What it filters | Example |
|---|---|---|
type | Entity type. Prefix with ! to exclude. | type=zombie · type=!player |
name | Exact name. Use quotes when it has spaces. ! excludes. | name="Bob the Trader" |
tag | Has a tag given with /tag. Repeat for several tags. tag=!x means not tagged x. tag= means no tags at all. | tag=red,tag=!dead |
family | Entity family from the behavior pack. | family=monster · family=undead |
m | Game mode of a player. | m=survival · m=!creative |
r, rm | Maximum and minimum distance in blocks from the position. | r=10 · rm=3,r=10 |
x, y, z | Position to measure from instead of where the command runs. | x=0,y=64,z=0,r=5 |
dx, dy, dz | A box starting at x y z. Everything touching the box is selected. | x=0,y=60,z=0,dx=10,dy=5,dz=10 |
c | Limit. Positive = nearest first, negative = farthest first. | c=1 · c=-3 |
l, lm | Maximum and minimum experience level. | lm=30 · l=5 |
scores | Scoreboard values. Ranges use two dots. | scores={coins=10..} · scores={lives=!0} |
hasitem | Players or mobs carrying an item, optionally in a slot and quantity. | hasitem={item=diamond,quantity=1..} |
rx, rxm | Maximum and minimum pitch (looking up or down, -90 to 90). | rxm=45,rx=90 |
ry, rym | Maximum and minimum yaw (compass direction, -180 to 180). | rym=-45,ry=45 |
haspermission | Players with an input permission enabled or disabled. | haspermission={camera=enabled} |
has_property | Entities with a given entity property value. | has_property={minecraft:has_nectar=true} |
Checked examples
Each of these was accepted by a real Bedrock Dedicated Server (1.26.66.1).
/testfor @e[type=zombie,r=10]/testfor @e[type=zombie,r=10]/testfor @a[tag=red,tag=vip,tag=!dead,m=survival,c=3,scores={coins=10..}]/testfor @e[type=!player,family=monster,x=0,y=64,z=0,dx=10,dy=5,dz=10]/testfor @a[l=30,lm=5,rx=90,rxm=45,hasitem={item=diamond,location=slot.hotbar,quantity=1..}]/testfor @e[name=!"Bob the Trader",rm=2,ry=90,rym=-90]More from 9Minecraft
Bedrock ServersFind a Bedrock server to try your commands on.Server ToolsConfig, MOTD and admin tools that run in the browser.Bedrock WikiAdd-ons, blocks, items and version history.Marketplace TrackerFree packs and price drops on the Bedrock Marketplace.Bedrock SeedsSeeds with coordinates you can /tp to.GuidesStep-by-step help for installing and running Minecraft.
Command reference © 2026 9Minecraft.net. Syntax read from Minecraft Bedrock Edition 1.26.66.1.