How to destroy the instances that doesn't have a parent

I accidently let my plugin script add a lot of no parent instances to the game. How to Destroy them. Or if they cannot be destroyed, will they influence the memery?

Are they in a certain service or in the data model? You should be able to put game.(part name):Destroy()


megaimage

If there are no references to them (which I very much assume is the case since you made them accidentally with a plugin) the garage collector will automatically clear them and their memory footprint

Even if that wasn’t the case, I highly highly doubt parts parented to nil are saved when you close the game (it wouldn’t make any sense)

I didnt set the parent property of the instance that created by Instance.new() function.
For example:

local part = Instance.new()
part.Name = "a"
part.Color = Color3.new(1,1,1)

Thats all.
game[Instance.Name]:Destroy() didn’t work. There’s no auto complete and code will throw a “not valid member” error.

Oh then the parts don’t exist. If it threw an invalid member error, it’s probably not parented to anything and you’ll be fine.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.