Hey Devfourm, MisterSpeaks Here
What is the difference between “remove()” and “destroy()”
These two methods are very similar or exactly the same to my knowledge.
Could someone explain the difference between them if there is one?
Hey Devfourm, MisterSpeaks Here
What is the difference between “remove()” and “destroy()”
These two methods are very similar or exactly the same to my knowledge.
Could someone explain the difference between them if there is one?
They’re the same thing, Remove is just deprecated
deprecated? what do you mean by that?
I assume you mean Instance:Remove()
and Instance:Destroy()
.
Remove sets the parent to nil.
Destroy sets the parent to nil, disconnects all connections on the object’s events, and locks the parent property.
It’s discouraged for use in production
Yes, I am referring to Instance:Remove() and Instance:Destroy()
nil is just 0, right?
if it is then is there any way to recover it?
does it matter which one you use?
nil is nothing
0 is a number
not the same
so does it matter which one you use?
use :Destroy()
because :Remove()
won’t get any more updates and is deprecated
Yes.
Remove is deprecated, and the alternative is just to set Parent to nil.
Setting the parent to nil allows you to access it later, so if you want to remove something, but add it back in later, set the parent to nil.
Destroy is for permanently getting rid of objects. Use destroy if you won’t use something later, as it prevents memory leaks.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.