Different commands select different entities (with the same target selector)

Different commands select different entities (with the same target selector) - Closeup of stack of blue denim pants neatly arranged according to color from lightest to darkest

I was trying to set the scoreboard values of certain entities with a command like

/execute @e[type=ArmorStand] ~ ~ ~ detect ~ ~-1 ~ stone 0 scoreboard players set @e[c=1] myObj 1

and I noticed that it updated my score instead of the armor stand's. It was my understanding that the selector @e[c=1] selected the nearest entity, which should be the armor stand that is executing the command. To test this, I used the command

/execute @e[type=ArmorStand] ~ ~ ~ detect ~ ~-1 ~ stone 0 say @e[c=1]

and it said "Armor Stand", not my name.

This seems inconsistent. Is there a reason for this behavior or is it a bug? Is there a way to reliably select the entity that is executing the command?


P.S.: The same thing happens if I place a command block next to the armor stand and let it execute the commands: scoreboard players set @e[c=1] myObj 1 targets me (even though I am further away), but say @e[c=1] says "Armor Stand".






Pictures about "Different commands select different entities (with the same target selector)"

Different commands select different entities (with the same target selector) - Composition of different conchs on beige table
Different commands select different entities (with the same target selector) - Top view composition of shells assorted sizes arranged randomly on beige surface
Different commands select different entities (with the same target selector) - Top view of various multicolored toys for fight arranged on pink background as representation of game



How do you target specific entities in Minecraft?

The @e target selector is used to target all entities in the game. This includes both players and mobs in the world. Notice that in this last example, we have used [type=enderman] to target only enderman. This value is called a target selector argument and allows us to filter the target.

How do you use target selectors?

Targets a random player. Bedrock Edition can use @r to target non-player entities via the type selector argument; in Java Edition, to select a random entity, use @e[sort=random] instead. In Bedrock Edition, @r can only target entities who are alive. Targets every player, alive or not.

What does @R mean in Minecraft?

The other target selectors are \u201c@a\u201d for all players, \u201c@r\u201d for a random player, and \u201c@e\u201d will target all entities. Entities include everything that isn't a block, like monsters, snowballs, animals, and arrows.

How do you teleport to the nearest entity in Minecraft?

Players who want to move mobs to their character's position or move their character to the mob's position can use the following commands:
  • "/tp @e[type=mobtype] @p" will teleport mobs of a certain type to the closest player (usually you).
  • Typing "/tp @p @e[type=mobtype]" will move the player to them.




  • Target Selectors | Minecraft Bedrock | Command Augments | dx, dy, dz, r, rm, type, family, l, lm etc




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Karolina Grabowska, Karolina Grabowska, Karolina Grabowska, Anna Shvets