AttachToInstance
Automatically cleans the vault when the given Instance is destroyed.
- TypeScript
- Luau
const part = new Instance("Part")
vault.AttachToInstance(part)
part.Destroy()
local part = Instance.new("Part")
vault:AttachToInstance(part)
part:Destroy()
Parameters
| Parameter | Type | Description |
|---|---|---|
instance | Instance | Instance whose destruction triggers vault cleanup |
Returns
Connection - The Destroying signal connection (auto-added to vault)
Behavior
- Connects to the instance's
Destroyingsignal - When instance is destroyed, automatically cleans the vault
- Returns the connection for manual management if needed