Collector - Collecting Instances by Ancestors and Tags

Collector

Collector is a module that helps with storing and finding Instances with a specific Tag based on it’s Ancestor/Parent.

Module

API

CollectorModule.CreateCollector = function(parent : Instance, tagName) : Collector

Creates a so called “Collector”.


CollectorModule.GetInstancesFromTagAndParent = function(parent : Instance, tag : string) : {Instance}?


Collectors

Properties

Parent : Instance

The Instance whose descendants will be collected.

Tag : string

A string which represents which Tag the Instances need have to be collected.

Data : { {RBXScriptConnection}}

The (meta)table which stores connections and the Instances. The index is the Instance and the value is the (non-meta)table filled with connections.

Functions

:Destroy() → nil

The Collector (Metatable) get’s cleaned up or rather destroyed, like the :Destroy() function for normal Instances.

:SetParent(newParent : Instance)


Note

I made this module for personal use, like all the other modules I make and thus will only fix bugs or problems I have and might improve something about it. This post will thus also not always be up to date, just take a look inside the modules documention, I’ll try to keep it as simple as possible.

3 Likes