function PromiseInstanceUtils.promiseRemoved(X)assert(X:IsDescendantOf(game))local l=Maid.new()local x=Promise.new()l:GiveTask(X.AncestryChanged:Connect(function(X,l)if not l then x:Resolve()end end))x:Finally(function()l:DoCleaning()end)return x end return PromiseInstanceUtils

function PromiseInstanceUtils.promiseRemoved(instance)
	assert(instance:IsDescendantOf(game))

	local maid = Maid.new()

	local promise = Promise.new()

	maid:GiveTask(instance.AncestryChanged:Connect(function(_, parent)
		if not parent then
			promise:Resolve()
		end
	end))

	promise:Finally(function()
		maid:DoCleaning()
	end)

	return promise
end

return PromiseInstanceUtils
