First: local Part = workspace.Part
Let’s say that Part gets destroy in the game and the variable Part is never used through out the code. Will that part get GarbageCollected? Or will it stay there. Cuz I ain’t an industry of NIL to set it to each variable I don’t use… (Sorry for the last sentence)
if I have a function that is like:
local Part = workspace.Part
local Number = 5
while wait(1) do
Number = Number - 1
if Number <= 0 then
While the variable referencing the part is in scope or will enter a scope in the future (as an upvalue for example), it won’t be collected. First scenario is collected, second scenario is collected too after the loop breaks.
Last question and sorry for interrupt you again. What about a function that is in the _G Global Value? Let’s say the Second Option is in a _G variable. Will it get GarbageCollected as well? Cuz I heard rumors that some stuff don’t get collected in _G.