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


Sets the Instance/Parent property to nil, locks the Instance/Parent property, disconnects all connections and calls Destroy on all children. This function is the correct way to dispose of objects that are no longer required. Disposing of unneeded objects is important, since unnecessary objects and connections in a place use up memory (this is called a memory leak) which can lead to serious performance issues over time.

Once an Instance has been destroyed by this method it cannot be reused because the Instance/Parent property is locked. To temporarily remove an object, set Instance/Parent|Parent it to nil instead. For example:

object.Parent = nil
object.Parent = workspace

To Destroy an object after a set amount of time, use Debris/AddItem.


Return Type Summary

Code Samples


local Part = Workspace.Part
Part.Parent = Workspace --> The Parent property of Part is locked