function RxAttributeUtils.observeAttribute(G,z,q)assert(typeof(G)=="\073\110\115\116\097\110\099\101","\066\097\100 \105\110\115\116\097\110\099\101")assert(type(z)=="\115\116\114\105\110\103","\066\097\100 \097\116\116\114\105\098\117\116\101\078\097\109\101")return Observable.new(function(u)local t=Maid.new()local function P()local t=G:GetAttribute(z)if t==nil then u:Fire(q)else u:Fire(t)end end t:GiveTask((G:GetAttributeChangedSignal(z)):Connect(P))P()return t end)end return RxAttributeUtils
--[=[
	Observes an attribute on an instance.
	@param instance Instance
	@param attributeName string
	@param defaultValue any?
	@return Observable<any>
]=]
function RxAttributeUtils.observeAttribute(instance, attributeName, defaultValue)
	assert(typeof(instance) == "Instance", "Bad instance")
	assert(type(attributeName) == "string", "Bad attributeName")

	return Observable.new(function(sub)
		local maid = Maid.new()

		local function update()
			local value = instance:GetAttribute(attributeName)
			if value == nil then
				sub:Fire(defaultValue)
			else
				sub:Fire(value)
			end
		end

		maid:GiveTask(instance:GetAttributeChangedSignal(attributeName):Connect(update))
		update()

		return maid
	end)
end

return RxAttributeUtils
