Tags
marks entities with named tags and finds every entity with that tag
Methods
5 members Access: shared
- Add
(entity: Instance, tag: string) -> () add a tag to an entity
Parameters
Name Type Description entity Instance Entity to assign the tag to. tag string Name of the tag to assign. returns () — - Find
(tag: string) -> {Instance} find all entities with a tag
Parameters
Name Type Description tag string Name of the tag to search for. returns {Instance} — - Get
(entity: Instance) -> {string} list tags on an entity
Parameters
Name Type Description entity Instance Entity whose assigned tags to return. returns {string} — - Has
(entity: Instance, tag: string) -> boolean check whether an entity has a tag
Parameters
Name Type Description entity Instance Entity to check for the tag. tag string Name of the tag to test. returns boolean — - Remove
(entity: Instance, tag: string) -> () remove a tag from an entity
Parameters
Name Type Description entity Instance Entity to detach the tag from. tag string Name of the tag to remove. returns () —
Tagging Entities for Group Queries
Lifecycle: Server
Tags are string labels you can add, test, search, and remove without writing a component.
Luau
local chest = game.Prefabs.Spawn("TreasureChest")if chest then game.Tags.Add(chest, "Interactable") if game.Tags.Has(chest, "Interactable") then local items = game.Tags.Find("Interactable") print("Found interactable entities:", #items) end game.Tags.Remove(chest, "Interactable")end Output: Found interactable entities: 1