I’d like for there to be an option in Destroy on Instances that somehow sets the Instance to nil (override metatable stuff the only make it act like nil, and remove all entries in tables referencing it?). I run in to this a lot when setting up data structures where multiple tables all hold instances, preferably the tables would empty up as the Instances were deleted automatically. Sadly this is not the case, and I end up having to delete the instance, and assign the entry in the table to nil to clear up memory
What I mean by what I want, illustrated in my most common use case:
local Table = {Instance.new(“Part”)}
wait()
Table[1]:Destroy()
print(Table[1]) --> Part
Table[1] = nil – Required to empty the table, an extra line, or at worst, and extra .Changed event
print(Table[1]) --> nil, as desired
if it’s even possible to implement something like this, perhaps do so by passing a bool to Destroy, which defaults to false in whether or not it should nilify itself. Or if you’re not against bloat, a new method wouldn’t hurt.