Minecraft Wiki
Advertisement

Controls scoreboard tags on individual entities. In Java Edition, the number of tags owned by an entity cannot exceed 1024.[more information needed]

Java Edition note: This is distinct from entity type tags, which are applied to entity types and can't be changed by commands.

Syntax[]

  • Java Edition
tag <targets> add <name>
Adds a tag to the targets.
tag <targets> list
Lists all tags on the targets.
tag <targets> remove <name>
Removes a tag from the targets.
  • Bedrock Edition
tag <entity: targets> add <name: string>
Adds a tag to the targets.
tag <entity: targets> remove <name: string>
Removes a tag from the targets.
tag <entity: targets> list
Lists all tags on the targets.

Arguments[]

JE<targets>: entity
BE: entity: target: WildcardCommandSelector<Actor>

Specifies the command's target.
In Java Edition, must be a player name, a target selector or a UUID.
In Bedrock Edition, must be either a target selector, a player name, or * for all score holders.

JE<name>: string
BE: name: string: basic_string

Specifies the name of the tag to be added into or removed from the targets.
Must be a string. In Java Edition, it must be in a single word (Allowed characters include: -, +, ., _, A-Z, a-z, and 0-9). In Bedrock Edition, it must be a single word that has no space or a quoted string.

Result[]

CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Unparseable
<targets> or player: target fails to resolve to one or more entities (named players must be online) Failed Failed
/tag ... add ...All selected entities meet one or more of the following conditions:
  • it already had the specified tag
  • it already has 1024 tags‌[Java Edition only]
/tag ... remove ...there's no entity whose tag is removed
/tag ... list ...there's no entity that has any tag Successful
anyOtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
/tag ... add ...On success11the number of entities who get a new tag
/tag ... remove ...On success11the number of entities whose tags are remove
/tag ... listOn success11the number of all tags the specified entities have
anyBedrock EditionOn fail0N/AN/A
On success1N/AN/A

History[]

Java Edition
1.1317w45aAdded /tag.
Bedrock Edition
1.9beta 1.9.0.2Added /tag.

See also[]

Advertisement