GetInstanceRemoved is given a tag (a string) and returns a signal which fires under two conditions:
- The tag is removed from an object within the
- An object with the given tag is removed as a descendant of the
DataModel, e.g. by un-setting
Subsequent calls to this method with the same tag return the same signal object. The signal is useful for cleaning up resources used by objects that once had tags, such as disconnecting connections.
CollectionService/GetInstanceAddedSignal, which returns an event that fires under similar conditions.
Deadly Bricks using CollectionService
This code sample causes any
BasePart with the tag “Deadly” to kill any
Humanoid that touches it. It does this using a common pattern with
CollectionService: listen for all parts with the tag, and make a connection. When the tag is removed, disconnect. Instead of copying the same kill script into many bricks, use this pattern instead!