Should I use one over the other depending on the situation or does it not matter? Thanks.
What is the difference between m:Destroy() and m:Remove()?
4 answers
This is a common question many users have when scripting.
Remove is deprecated [meaning it's highly discouraged from use], while Destroy is the better method to use to get rid of an object.
Remove
Let's look at two scripts:
s = Instance.new("Part",workspace)
s.Parent = nil
and
s = Instance.new("Part",workspace)
s:Remove()
What you just saw above does the EXACT same thing. Remove merely sets the parent of the object to nil.
To prove this, we can do this:
s = Instance.new("Part",workspace)
s:Remove()
s.Parent = workspace
In the code example above, the part, although removed, is able to make its way to Workspace since all we did was just re-declare the parent and it came back.
Destroy
Destroy is different in a way:
s = Instance.new("Part",workspace)
s:Destroy()
Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children, thus why Roblox suggests we use Destroy over Remove
Let's prove this:
s = Instance.new("Part",workspace)
s:Destroy()
s.Parent = workspace
With the following code above, the part will never return.
Links
Destroy: http://wiki.roblox.com/index.php?title=API:Class/Instance/Destroy Remove: http://wiki.roblox.com/index.php?title=API:Class/Instance/Remove
7 comments
We said the exact same thing... BTW how do you make the text so big?
Okay, you just edited your too look EXACTLY like mine... WTF? Did you just add links and big text to look professional so you get upvoted? Just make your answer less like mine...
First off, I always post a general outline of what the answer should be. Then I take the time to edit the post to add more information. I didn't even see your post till I finished editing. I didn't copy you at all. We just both know what we're talking about.
Also, which text are you talking about?
Well then okay, also I'm talking about the text like "Links" and "Destroy", they look like titles.
Ah, what you do is, type in a word, like 'Title' or something, then hit Enter, and then put, '-----' : basically 5 "-"
Why didn't the Owner import that before??
Remove is deprecated the other one isn't.
Remove only changes the parent to nil. So remove doesn't actually remove the object. So you can do this.
local part = workspace.Part
part:remove()
wait(3)
part.Parent = workspace --The part will disappear for 3 seconds then come back.
This is the same as doing this
local part = workspace.Part
part.Parent = nil --Parent is nil, remove changes the parent of an object to nil
wait(3)
part.Parent = workspace --The part will disappear for 3 seconds then come back.
Destroy actually destroys the object. If it's destroyed, it's done. You cannot bring it back.
local part = workspace.Part
part:Destroy()
wait(3)
part.Parent = workspace --The part will disappear forever! and the script will also error since part does not exist anymore.
Hope this helps!
The different between Destroy and Remove is that;
Destroy: Destroy removes the Child/Target, then will lock the Child and it's Descendants, preventing it from being used again.
Remove: Remove only reverts the Child's Parent property to nil, without locking it or it's Descendants, allowing the user to use the Model/Child again, however, due to you being able to set a Child's Parent manually without remove [Is what I'm guessing], Remove has become Deprecated.
Hope this helped!
All I know is that, both works the same.
1 comment
No they do not...
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Please search in the Search bar first. https://scriptinghelpers.org/questions/15726/what-is-the-difference-between-remove-and-destroy
Ohh ok sorry I didn't realize you can do that. My bad.