Questions about the LUA garbage collector

So, I was researching memory and data leaks and came across something called the LUA garbage collector, and it said that it removes unused variables and frees up memory usage. And then I found a post explaining to truly get rid of a part from memory you need to run the code “part = nil”. On further googling I can’t really find anything that documents it in full detail.

My questions are

  1. Can destroyed [:Destroy()] parts still cause lag?
  2. Is it just for variables and not for the instances themselves?
  3. If I set a variable/part to nil, do I need to set its children to nil also?
  4. Are there any functions to trigger the garbage collector built into Roblox?
2 Likes

Whats wrong with destroy, seems like nil would cause more lag

1 Like