-- Variables

local DefaultTime = 5 -- Default is to delete over 5 seconds
local DefaultScenePosition = Vector3.new(0, 0, 0)

local function GiveObjectPrimaryPart(Obj)
	-- Setup the object inside a model, provide a PrimaryPart
	local Model = Instance.new("Model")
	Model.Parent = Obj.Parent
	local Part = Instance.new("Part")
	Part.Anchored = true
	Part.CanCollide = false
	Part.Transparency = 1
	Part.Parent = Model
	Model.PrimaryPart = Part
	if Obj:IsA("Model") and Obj.PrimaryPart then
		Part.Position = Obj.PrimaryPart.Position
	else
		Part.Position = DefaultScenePosition
	end
	Obj.Parent = Model
	return Model
end

local function DeleteAmountOfObjectsInTable(Table, DeleteGoal)
	local JustDestroyed = 0
	for i = #Table, 1, -1 do
		local Object = Table[i]
		if Object and Object.Parent then
			Object:Destroy()
		end
		table.remove(Table, i)
		JustDestroyed += 1
		if #Table <= 0 then
			return true
		elseif JustDestroyed >= DeleteGoal then
			return false
		end
	end
end
