Skip to content
Roblox API Reference

CollectionService

A service which manages instance collections using assigned tags.
  • Not creatable
  • Service
Memory category
Instances
Own members
17
Inherited members
75
Subclasses
0
Siblings
608

Properties23

Inherited fromObject2

Property categoryData

Inherited fromInstance21

Property categoryBehavior

Property categoryData

Property categoryPermissions

Methods55

Inherited fromObject3
  • Get an event that fires when a given property of the object changes.
    Parameters
    ParameterDescription
    property: string
    The property to connect to.
    Returns
    TypeDescription
    RBXScriptSignal
    A signal that fires whenever the property changes.
  • Object:IsA(className: string): boolean
    Returns true if an object's class matches or inherits from a given class.
    • Custom Lua state
    • Thread safe
    Parameters
    ParameterDescription
    className: string
    The class against which the Object's class will be checked. Case-sensitive.
    Returns
    TypeDescription
    boolean
    Describes whether the Object's class matched or is a subclass of the given class.
  • Object:isA(className: string): boolean
    Deprecated: This deprecated function is a variant of Object:IsA() which should be used instead.
    • Deprecated
    • Custom Lua state
    Parameters
    Parameter
    className: string
    Returns
    Type
    boolean

    Use IsA instead.

Inherited fromInstance39
Defined byCollectionService13
  • CollectionService:AddTag(instance: Instance, tag: string)
    Applies a tag to an Instance.
    • Custom Lua state
    • Capabilities: Basic
    Parameters
    ParameterDescription
    instance: Instance
    The Instance to apply the tag to.
    tag: string
    The tag string to apply to the instance.
  • CollectionService:CreateCollection(query: string,root: Instance? = nil,): CollectionHandle
    Creates a Collection that tracks every instance matching a query.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    query: string
    A selector string describing which instances to match. See the description for the supported syntax.
    root: Instance? = nil
    The instance whose descendants are searched. Pass this to restrict the search to a subtree, such that instances outside that subtree never match and an instance is removed from the collection if it is reparented out of root. Defaults to Workspace when omitted.
    Returns
    TypeDescription
    CollectionHandle
    A Collection that reactively tracks the instances matching query.
  • CollectionService:GetAllTags(): { any }
    Returns an array of all tags in the experience.
    • Thread safe
    • Capabilities: Basic
    Returns
    TypeDescription
    { any }
    An array of all tags that currently have at least one tagged instance in the DataModel.
  • CollectionService:GetCollections(instance: Instance): { any }
    • Capabilities: Basic
    Parameters
    Parameter
    instance: Instance
    Returns
    Type
    { any }
  • CollectionService:GetInstanceAddedSignal(tag: string): RBXScriptSignal
    Returns a signal that fires when a given tag is added to an instance.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    tag: string
    The tag to watch for.
    Returns
    TypeDescription
    RBXScriptSignal
    An event that fires when you add the tag to an instance.
  • CollectionService:GetInstanceRemovedSignal(tag: string): RBXScriptSignal
    Returns a signal that fires when a given tag is removed from an instance.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    tag: string
    The tag to watch for.
    Returns
    TypeDescription
    RBXScriptSignal
    An event that fires when you remove the tag from an instance.
  • CollectionService:GetTagAddedSignal(instance: Instance): RBXScriptSignal
    • Roblox script security
    • Capabilities: Basic
    Parameters
    Parameter
    instance: Instance
    Returns
    Type
    RBXScriptSignal
  • CollectionService:GetTagged(tag: string): { Instance }
    Returns an array of instances in the game with a given tag.
    • Thread safe
    • Capabilities: Basic
    Parameters
    ParameterDescription
    tag: string
    The tag to search for.
    Returns
    TypeDescription
    { Instance }
    An array of all instances with the tag.
  • CollectionService:GetTagRemovedSignal(instance: Instance): RBXScriptSignal
    • Roblox script security
    • Capabilities: Basic
    Parameters
    Parameter
    instance: Instance
    Returns
    Type
    RBXScriptSignal
  • CollectionService:GetTags(instance: Instance): { any }
    Gets an array of all tags applied to a given instance.
    • Custom Lua state
    • Thread safe
    • Capabilities: Basic
    Parameters
    ParameterDescription
    instance: Instance
    The instance whose tags should be returned.
    Returns
    TypeDescription
    { any }
    An array of strings which are the tags applied to the given instance.
  • CollectionService:HasTag(instance: Instance, tag: string): boolean
    Check whether an instance has a given tag.
    • Custom Lua state
    • Thread safe
    • Capabilities: Basic
    Parameters
    ParameterDescription
    instance: Instance
    The instance to check for the presence of a tag.
    tag: string
    The tag to check for.
    Returns
    TypeDescription
    boolean
    Whether the instance has the tag.
  • CollectionService:RemoveTag(instance: Instance, tag: string)
    Removes a tag from an instance.
    • Custom Lua state
    • Capabilities: Basic
    Parameters
    ParameterDescription
    instance: Instance
    The instance to remove the tag from.
    tag: string
    The tag to remove from the instance.
  • CollectionService:GetCollection(class: string): { Instance }
    Deprecated: This item has been superseded by a CollectionService tagging method. The equivalent function using the new method is CollectionService:GetTagged() which should be used in new work.
    Returns all instances of a given class which are in the DataModel.
    • Deprecated
    • Capabilities: Basic
    Parameters
    ParameterDescription
    class: string
    The class type to retrieve instances of.
    Returns
    TypeDescription
    { Instance }
    An array of all instances of the specified class in the DataModel.

    Use GetTagged instead.

Events14

Inherited fromObject1
Inherited fromInstance9
Defined byCollectionService4