function RxBrioUtils.toEmitOnDeathObservable(b,P)if not Brio.isBrio(b)then return Rx.of(b)else return Observable.new(function(v)if b:IsDead()then v:Fire(P)v:Complete()else v:Fire(b:GetValue())return(b:GetDiedSignal()):Connect(function()v:Fire(P)v:Complete()end)end end)end end

function RxBrioUtils.toEmitOnDeathObservable(brio, emitOnDeathValue)
	if not Brio.isBrio(brio) then
		return Rx.of(brio)
	else
		return Observable.new(function(sub)
			if brio:IsDead() then
				sub:Fire(emitOnDeathValue)
				sub:Complete()
			else
				sub:Fire(brio:GetValue())
				return brio:GetDiedSignal():Connect(function()
					sub:Fire(emitOnDeathValue)
					sub:Complete()
				end)
			end
		end)
	end
end
