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: Remove, Setting parent to nil, or destroy?

Previous Thread :: Next Thread 
kubuto2 is not online. kubuto2
Joined: 16 Jul 2008
Total Posts: 1275
07 Jan 2014 04:37 PM
Remove sets the object's parent to nil anyways and destroy wipes the object from the game.

Which one is more efficient to use?

I ask this, because creating a mass of objects creates less lag than destroying the same amount of objects.

Removing and setting the parent to nil is the same thing, from that I would like to know if a method is better than changing the value of an object.
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
07 Jan 2014 04:52 PM
:Destroy() or gtfo.
Report Abuse
kubuto2 is not online. kubuto2
Joined: 16 Jul 2008
Total Posts: 1275
07 Jan 2014 04:58 PM
Would if I would like to set an object to nil?

Would Remove() or setting the property of parent be better?
Report Abuse
bezgar is not online. bezgar
Joined: 19 Dec 2013
Total Posts: 4
07 Jan 2014 04:58 PM
I don't think :destroy() wipes the object from the game. It just locks the parent property. The 'Name' property etc can still be read. Doesn't this mean it still exists?
Report Abuse
bezgar is not online. bezgar
Joined: 19 Dec 2013
Total Posts: 4
07 Jan 2014 05:03 PM
and I think :remove() would be faster since it's C++ (citation needed).
Report Abuse
chickenman158 is not online. chickenman158
Joined: 18 Jan 2011
Total Posts: 915
07 Jan 2014 05:07 PM
Such misinformed. Wow.
Report Abuse
HaxHelper is not online. HaxHelper
Joined: 19 Dec 2009
Total Posts: 1208
07 Jan 2014 05:08 PM
depends on what you want to do with it after

brush up on your methods pls
Report Abuse
Aerideyn is not online. Aerideyn
Joined: 16 Jan 2010
Total Posts: 1882
07 Jan 2014 06:25 PM
Destroy() Remove() from your mind. it is depreciated and you should not use it.

Your 2 options are then as follows:

Destroy()
Will delete the object and all of it's children and will lock any further access to them. Once it's gone it is gone.

Parent = nil
Removes the object from the game, but the object will hang around until there are no more references to it.
If you have a reference to that object in a table for example and never remove that entry - the object will never be cleaned up.
This could be what you want - or it might not be.


Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
07 Jan 2014 06:37 PM
http://wiki.roblox.com/index.php/User:JulienDethurens/Essays/Removing_objects

This is a good article about different methods of removing instances.
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