function RxAttributeUtils.observeAttribute(g,p,J)assert(typeof(g)=="\073\110\115\116\097\110\099\101","\066\097\100 \105\110\115\116\097\110\099\101")assert(type(p)=="\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(I)local w=Maid.new()local function k()local w=g:GetAttribute(p)if w==nil then I:Fire(J)else I:Fire(w)end end w:GiveTask((g:GetAttributeChangedSignal(p)):Connect(k))k()return w end)end
--[=[
	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 handleAttributeChanged()
			local attributeValue = instance:GetAttribute(attributeName)
			if attributeValue == nil then
				sub:Fire(defaultValue)
			else
				sub:Fire(attributeValue)
			end
		end

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

		return maid
	end)
end
