function ObservableSubscriptionTable.Observe(r,A)assert(A~=nil,"\066\097\100 \107\101\121")return Observable.new(function(t)if not r._subMap[A]then r._subMap[A]={t}else table.insert(r._subMap[A],t)end return function()if not r._subMap[A]then return end local B=r._subMap[A]local h=table.find(B,t)if not h then return end table.remove(B,h)if#B==0 then r._subMap[A]=nil end if t:IsPending()then task.spawn(function()t:Complete()end)end end end)end
--[=[
	Observes for the key
	@param key TKey
	@return Observable<TEmit>
]=]
function ObservableSubscriptionTable:Observe(key)
	assert(key ~= nil, "Bad key")

	return Observable.new(function(sub)
		if not self._subMap[key] then
			self._subMap[key] = { sub }
		else
			table.insert(self._subMap[key], sub)
		end

		return function()
			if not self._subMap[key] then
				return
			end

			local current = self._subMap[key]
			local index = table.find(current, sub)
			if not index then
				return
			end

			table.remove(current, index)
			if #current == 0 then
				self._subMap[key] = nil
			end

			-- Complete the subscription
			if sub:IsPending() then
				task.spawn(function()
					sub:Complete()
				end)
			end
		end
	end)
end
