function Maid.GiveTask(k,a)local V=#k._tasks+1 k._tasks[V]=a return function()k._tasks[V]=nil end end function Maid.GiveTasks(a,...)for k,V in next,{...}do a:GiveTask(V)end end function Maid.DoCleaning(a)for k,V in next,a._tasks do a._tasks[k]=nil local l=type(V)if l=="\116\097\098\108\101"then V:Destroy()elseif l=="\102\117\110\099\116\105\111\110"then V()else V:Disconnect()end end end Maid.Destroy=Maid.DoCleaning
-- Public

function Maid:GiveTask(task)
	local index = #self._tasks + 1
	self._tasks[index] = task

	return function()
		self._tasks[index] = nil
	end
end

function Maid:GiveTasks(...)
	for _, task in next, { ... } do
		self:GiveTask(task)
	end
end

function Maid:DoCleaning()
	for index, task in next, self._tasks do
		self._tasks[index] = nil

		local T = type(task)
		if T == "table" then
			task:Destroy()
		elseif T == "function" then
			task()
		else -- RbxScriptConnection
			task:Disconnect()
		end
	end
end

Maid.Destroy = Maid.DoCleaning
