Hello, I am writing a library for custom objects that behave like Instances. As we know, Instances are userdatas.
I am trying to replicate the behavior of :Destroy into my library. Does Destroy just flag it for garbage collecting and parent it to nil? Or is there more that occurs to its children and members?
:Destroy locks the parent property, parents the instance to nil, parents all the descendants to nil, and disconnects all events connected to it (as stated in the article you mentioned above). Once all references to an object/custom class (in OOP) are lost, Iām pretty sure it gets flagged for garbage collection (after looking at this).