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.

Open the selector builder →

Selector variables

VariableSelects
@pThe nearest player to where the command runs.
@aEvery player, including dead ones.
@rOne random player. Add type= to pick a random entity of that type instead.
@eEvery loaded entity: players, mobs, items, projectiles.
@sThe entity running the command.
@initiatorThe 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].

ArgumentWhat it filtersExample
typeEntity type. Prefix with ! to exclude.type=zombie · type=!player
nameExact name. Use quotes when it has spaces. ! excludes.name="Bob the Trader"
tagHas 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
familyEntity family from the behavior pack.family=monster · family=undead
mGame mode of a player.m=survival · m=!creative
r, rmMaximum and minimum distance in blocks from the position.r=10 · rm=3,r=10
x, y, zPosition to measure from instead of where the command runs.x=0,y=64,z=0,r=5
dx, dy, dzA box starting at x y z. Everything touching the box is selected.x=0,y=60,z=0,dx=10,dy=5,dz=10
cLimit. Positive = nearest first, negative = farthest first.c=1 · c=-3
l, lmMaximum and minimum experience level.lm=30 · l=5
scoresScoreboard values. Ranges use two dots.scores={coins=10..} · scores={lives=!0}
hasitemPlayers or mobs carrying an item, optionally in a slot and quantity.hasitem={item=diamond,quantity=1..}
rx, rxmMaximum and minimum pitch (looking up or down, -90 to 90).rxm=45,rx=90
ry, rymMaximum and minimum yaw (compass direction, -180 to 180).rym=-45,ry=45
haspermissionPlayers with an input permission enabled or disabled.haspermission={camera=enabled}
has_propertyEntities 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

Command reference © 2026 9Minecraft.net. Syntax read from Minecraft Bedrock Edition 1.26.66.1.