So I’m learning OOP and I really want to know how roblox destroy method works exactly
The Destroy()
function basically just sets the object’s parent to nil
. Easy Peasy. Read the posts below mine for more information.
Destroy works by setting the parent property to nil, locks the Parent property, disconnects all connections and also does thsi on all of its children
https://developer.roblox.com/en-us/api-reference/function/Instance/Destroy
The Roblox engine is closed-source. However, it works by setting the parent to nil, locking the parent property, and disconnecting any connections. So you’ll have to keep track of connections for your custom object so when your custom destroy method is called it will clean those up.
Alright, I thought it’d be something like that but I wanted a confirmation, tysm and thank you all!
oops, I didn’t know it said it in the description of Destroy, sorry that was a bit dumb but thanks eitherway
Haha it’s okay, sometimes we miss the details resources give us! In the end, you got your answer and that’s what matters!