to String

Return a string that has the game name (notation) for this target selector.

mobs.target(ALL_ENTITIES).toString();

When used inside a ||player:say|| block, this block will print the names of selected entities. This can be useful to see a list of every entity in your world!

Example

This code prints a list of all entities in the current world.

let mySelector: TargetSelector = null
mySelector = mobs.target(ALL_ENTITIES)
player.say(mySelector.toString())

See Also

You can read about how target selectors work in the Minecraft wiki.