|
| 26 Jan 2014 02:27 PM |
So instead of saying
game.Workspace.Brick:Remove()
I'd say
game.Workspace.Brick.Parent = game.Debris |
|
|
| Report Abuse |
|
|
iIikeyou
|
  |
| Joined: 07 Mar 2012 |
| Total Posts: 1659 |
|
|
| 26 Jan 2014 02:28 PM |
no say workspace.Brick:Destroy() |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2014 02:28 PM |
That will only make your game laggier and take up more RAM, as the parts still exist in debris. Use this instead:
game.Workspace.Brick:Destroy()
Destroy locks the part's Parent as nil, closes any connections (as in .Touched, .Changed, etc.), and basically primes it for garbagecollection (what ROBLOX uses to take things that are not being referenced anymore out of the game's memory).
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2014 02:45 PM |
| Now if destroy primes it for garbagecollecion, what does remove do? |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2014 02:51 PM |
Remove is simply not as efficient. It does not lock the Parent property, or disconnect connections. If I'm correct, the connections will stop the Part from being collected. However, don't quote me on that.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|