Collapse Sidebar


GetTags is given an object and returns a table of strings, which are the tags applied to the given object.

local CollectionService = game:GetService("CollectionService")
local object = workspace.Model
local tags = CollectionService:GetTags(object)
print("The object " .. object:GetFullName() .. " has tags: " .. table.concat(tags, ", "))

This method is useful when you want to do something with multiple tags at once on an object. However, it would be inefficient to use this method to check for the existence of a single tag. For this, use CollectionService/HasTag to check for a single tag.


Name Type Default Description

The object whose tags should be returned


Return Type Summary

A table of strings which are the tags applied to the given object

Code Samples

Using Tags and CollectionService

This code sample demonstrates adding, removing and querying a tag from an object using CollectionService. Be sure to add a Part to the Workspace before running this code.