function Scheduler.AddItem(I,R)assert(AddItemTuple(I,R))local C=tick()+(R or 10)local y y=Heartbeat:Connect(function()if tick()>=C then y:Disconnect()if I then if I.Destroy then pcall(I.Destroy,I)elseif I.destroy then pcall(I.destroy,I)elseif I.Disconnect then pcall(I.Disconnect,I)elseif I.disconnect then pcall(I.disconnect,I)end end end end)return y end return Scheduler

function Scheduler.AddItem(Object, Lifetime)
	assert(AddItemTuple(Object, Lifetime))
	local ExecuteTime = tick() + (Lifetime or 10)
	local Connection

	Connection = Heartbeat:Connect(function()
		if tick() >= ExecuteTime then
			Connection:Disconnect()
			if Object then
				if Object.Destroy then
					pcall(Object.Destroy, Object)
				elseif Object.destroy then
					pcall(Object.destroy, Object)
				elseif Object.Disconnect then
					pcall(Object.Disconnect, Object)
				elseif Object.disconnect then
					pcall(Object.disconnect, Object)
				end
			end
		end
	end)

	return Connection
end

return Scheduler
