local I={}local A={}function I.AddItem(X,I,e)local a=os.time()local S={object=I;destroyTime=e+a}for I,e in pairs(A)do if A[I].destroyTime>S.destroyTime then table.insert(A,I,S)return true end end table.insert(A,S)return true end local e=coroutine.create(function()while true do local I=os.time()for e,X in pairs(A)do if I>=X.destroyTime then table.remove(A,1)if X.object then X.object:Destroy()end elseif I>=X.destroyTime-1 then if X.object and X.object:IsA("\080\097\114\116")then local I=X.object.Transparency+.033333333333333 X.object.Transparency=I end else break end end wait()end end)coroutine.resume(e)return I
local destroyService = {}

local destroyQueue = {}

function destroyService:AddItem(theobject, delay)
	local now = os.time()
	local destroyObject = {object = theobject, destroyTime = delay + now}
	for i, storedObject in pairs(destroyQueue) do
		if destroyQueue[i].destroyTime > destroyObject.destroyTime then
			table.insert(destroyQueue, i, destroyObject)
			return true
		end
	end
	table.insert(destroyQueue, destroyObject)
	return true
end

local updateThread = coroutine.create(function()
	while true do 
		local now = os.time()
		for _, storedObject in pairs(destroyQueue) do
			if now >= storedObject.destroyTime then
				table.remove(destroyQueue, 1)
				if storedObject.object then
					storedObject.object:Destroy()
				end
			elseif now >= storedObject.destroyTime - 1 then
				
				if storedObject.object and storedObject.object:IsA("Part") then
					local trans = storedObject.object.Transparency + 1/30
					storedObject.object.Transparency = trans
				end
			else 
				break
			end
		end
		wait()
	end
end)

coroutine.resume(updateThread)

return destroyService