function AttributeUtils.bindToBinder(H,o,M)assert(M,"\066\097\100 \098\105\110\100\101\114")assert(typeof(H)=="\073\110\115\116\097\110\099\101","\066\097\100 \105\110\115\116\097\110\099\101")assert(type(o)=="\115\116\114\105\110\103","\066\097\100 \097\116\116\114\105\098\117\116\101\078\097\109\101")local W=Maid.new()local function J()if H:GetAttribute(o)then if RunService:IsClient()then M:BindClient(H)else M:Bind(H)end else if RunService:IsClient()then M:UnbindClient(H)else M:Unbind(H)end end end W:GiveTask((H:GetAttributeChangedSignal(o)):Connect(J))local function L()if M:Get(H)then H:SetAttribute(o,true)else H:SetAttribute(o,false)end end W:GiveTask(M:ObserveInstance(H,L))if M:Get(H)or H:GetAttribute(o)then H:SetAttribute(o,true)if RunService:IsClient()then M:BindClient(H)else M:Bind(H)end else H:SetAttribute(o,false)end W:GiveTask(function()W:DoCleaning()H:SetAttribute(o,nil)end)return W end

function AttributeUtils.bindToBinder(instance, attributeName, binder)
	assert(binder, "Bad binder")
	assert(typeof(instance) == "Instance", "Bad instance")
	assert(type(attributeName) == "string", "Bad attributeName")

	local maid = Maid.new()

	local function syncAttribute()
		if instance:GetAttribute(attributeName) then
			if RunService:IsClient() then
				binder:BindClient(instance)
			else
				binder:Bind(instance)
			end
		else
			if RunService:IsClient() then
				binder:UnbindClient(instance)
			else
				binder:Unbind(instance)
			end
		end
	end
	maid:GiveTask(instance:GetAttributeChangedSignal(attributeName):Connect(syncAttribute))

	local function syncBoundClass()
		if binder:Get(instance) then
			instance:SetAttribute(attributeName, true)
		else
			instance:SetAttribute(attributeName, false)
		end
	end
	maid:GiveTask(binder:ObserveInstance(instance, syncBoundClass))

	if binder:Get(instance) or instance:GetAttribute(attributeName) then
		instance:SetAttribute(attributeName, true)
		if RunService:IsClient() then
			binder:BindClient(instance)
		else
			binder:Bind(instance)
		end
	else
		instance:SetAttribute(attributeName, false)
		-- no need to bind
	end

	-- Depopuplate the attribute on exit
	maid:GiveTask(function()
		-- Force all cleaning first
		maid:DoCleaning()

		-- Cleanup
		instance:SetAttribute(attributeName, nil)
	end)

	return maid
end
