Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What is the Difference between "remove" and "destroy" ?

Asked by
woodengop 1134 Moderation Voter
9 years ago

I have Always Asked that Question What is the difference between Remove and Destroy, Does Remove Actually Delete an Object from the Game, Or Destroy?

3 answers

Log in to vote
1
Answered by
yumtaste 476 Moderation Voter
9 years ago

EDIT: After reading the Wiki, I can now give you a better answer.

Remove() is deprecated in favor of destroy(). So if you're making new scripts, don't use remove(), it only exists for compatibility (so it doesn't wreck everyone's scripts). Remove sets the object and all of its descendants to nil.

Destroy() completely, well, destroys the object and all of its descendants. According to the wiki, destroy() "sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children."

So who's the winner here?

Destroy() is better. The only reason it's better is because remove() is deprecated and doesn't really remove objects.

1
But Why would ROBLOX Create 'Destroy" and 'Remove" if they have the same Purpose? woodengop 1134 — 9y
1
I don't know. Ask ROBLOX. yumtaste 476 — 9y
0
xD woodengop 1134 — 9y
0
Lol I found the answer. Remove() is deprecated. yumtaste 476 — 9y
View all comments (5 more)
2
The Remove method was created prior to the creation of Destroy. The Remove method did not actually delete items correctly and caused the need for a new and more efficient method that was known as Destroy. Aethex 256 — 9y
1
Thanks Again! +1 Point and accepted Answer! woodengop 1134 — 9y
0
I saw that, too. I think I put an answer there XD yumtaste 476 — 9y
0
You can recover a destroyed object by Cloning it and setting its parent. JayzYeah32 62 — 5y
Ad
Log in to vote
0
Answered by 9 years ago

The :Destroy() Method completely destroys the object by making it nil and locking it. :remove() just sets the object to nil. While it can still be set back. This is what I heard. Not sure if it's correct.

Log in to vote
0
Answered by 9 years ago

I'm pretty sure remove is just deprecated

Answer this question