generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: wait whats the difference between :remove() and :Destroy()

Previous Thread :: Next Thread 
IceFromSpace is not online. IceFromSpace
Joined: 12 Dec 2015
Total Posts: 710
23 Jun 2016 10:54 PM
removes deprecated but that only means its not recommended

title
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
23 Jun 2016 10:55 PM
remove makes it nil destroy does something else


Add 13,000 posts
Report Abuse
FantasyStudios is not online. FantasyStudios
Joined: 17 Apr 2012
Total Posts: 214
23 Jun 2016 10:55 PM
Well I only use remove() so I would't really know... wait why is it not recommended?
Report Abuse
Borsy is not online. Borsy
Joined: 31 Jul 2014
Total Posts: 15111
23 Jun 2016 10:56 PM
i think remove doesn't stop sounds, destroy does
either way just use :Destroy() unless you love blue underlines


Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
23 Jun 2016 10:57 PM
Remove just parents it to nil so it's recommenced to use object.Parent = nil instead.
But with Destroy it Destroys it and you can't get it back.

So with Remove the object still exists, so if you have a gun and all the buttons use remove they will all still exist and over time make the sever lag really bad.
Report Abuse
IceFromSpace is not online. IceFromSpace
Joined: 12 Dec 2015
Total Posts: 710
23 Jun 2016 10:57 PM
"remove() makes it nil"

doesnt that mean it gets rid of it, it no longer will appear in workspace, and doesnt destroy do the same thing


if i did part:remove() and part:Destroy() they do the exact same thing
Report Abuse
eRanged is online. eRanged
Joined: 15 Jun 2013
Total Posts: 9746
23 Jun 2016 10:57 PM
remove makes it nil, Destroy actually destroys the object I believe. I think destroy is better for lagging purposes because it's still apart of the game with remove.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
23 Jun 2016 10:57 PM
destroy doesn't make it nil, it entirely destroys it

making the parent nil is different


Add 13,000 posts
Report Abuse
IceFromSpace is not online. IceFromSpace
Joined: 12 Dec 2015
Total Posts: 710
23 Jun 2016 10:57 PM
ohhhhhhh ty
Report Abuse
Borsy is not online. Borsy
Joined: 31 Jul 2014
Total Posts: 15111
23 Jun 2016 10:58 PM
basically using remove will be less efficient and more ram usage


Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
23 Jun 2016 10:59 PM
Remove just eat up peoples memory so don't use it at all.
Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
23 Jun 2016 11:53 PM
Remove() is out dated and was replaced with Destroy().

So don't use remove() it shouldn't even work as it's very inefficient.
Report Abuse
Twisted_Christmas is not online. Twisted_Christmas
Joined: 01 Apr 2012
Total Posts: 178
23 Jun 2016 11:55 PM
They should just replace the remove code with the Destroy code... remove looks and sounds better... in my opinion, mind you.
Report Abuse
Borsy is not online. Borsy
Joined: 31 Jul 2014
Total Posts: 15111
23 Jun 2016 11:57 PM
@twisted
it'd break scripts
some scripts still use remove() in case it needs to get it back


Report Abuse
Twisted_Christmas is not online. Twisted_Christmas
Joined: 01 Apr 2012
Total Posts: 178
23 Jun 2016 11:59 PM
true :/
Report Abuse
jmt99 is online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
24 Jun 2016 12:06 AM
@DevVince


Actually, you can still get the instance back with :Destroy()

You simply just need to have a reference to the instance before it was destroyed, and then call :Clone() on it, and then you can parent it back to the Workspace or whatever.


Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
24 Jun 2016 08:34 AM
@jmt99
Calling :Clone() will clone the object.
You will not actually get the exact same object back.

But what you are saying is true, and kind of weird.
Because this means that as long as there is still a reference to the object, the object still exists somewhere after it has been destroyed.

Which I find lacking.

There should be a function that can actually destroy an object.
Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
24 Jun 2016 09:02 AM
I wonder if this object existance affects game performance. If so, we need an actual thing that really destroys the object.
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
24 Jun 2016 09:07 AM
@Iliuminatis

That's exactly what I am talking about.

We want to optimize our scripts, but as you can see, ROBLOX doesn't let us because they do not have a proper destroy function.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Jun 2016 09:08 AM
Obviously it would affect performance, but probably not much unless you're deleting tons of stuff.
And the references are removed eventually, especially if you use local variables, so you shouldn't worry about it.
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
24 Jun 2016 09:12 AM
The references are eventually removed indeed, but still:

local baseplate = workspace.Baseplate

baseplate:Destroy()


wait(1)

print(baseplate)

baseplate:Clone().Parent = workspace



This works, and it looks sketchy af.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Jun 2016 09:15 AM
I think what is happening (Take note that I don't know much about this low-level stuff) is that the memory is freed and available for use, but it doesn't get removed immediately, it is only removed when it is overwritten, which will take place when something needs the space.
Otherwise, Roblox would be one big memory leak.
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
24 Jun 2016 09:19 AM
I think it's the last case,

Memory doesn't work like that 'is freed and available for use, but it doesn't get removed immediately, it is only removed when it is overwritten,'


I'm pretty sure.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Jun 2016 09:19 AM
IIRC, that's the case with hard drives too. That's why just "Deleting stuff" doesn't prevent info and files from being stolen. It only frees the space, it won't erase it.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Jun 2016 09:20 AM
I suppose if you really wanted to know, this is right up Flux_Capacitor's alley.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image