PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetInstanceRemovedSignal

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 DataModel (game) using CollectionService/RemoveTag
  • An object with the given tag is removed as a descendant of the DataModel, e.g. by un-setting Instance/Parent or similar

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.

See also CollectionService/GetInstanceAddedSignal, which returns an event that fires under similar conditions.

Parameters

Name Type Default Description

tag

Returns

Return Type Summary

Code Samples


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!