local H=require(((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\080\097\099\107\097\103\101")).MWorks)local G={}function G.setupUpdate(G)G.Updated=H.newBindable()end function G.newClass(H)local n={}if H then for H,G in pairs(H)do n[H]=G end end setmetatable(n,{__index=G})n:setupUpdate()return n end function G.newSubClass(n,H,G)local Q={}n[H]=Q if G then for H,G in pairs(G)do n[H]=G end end setmetatable(Q,{__index=n})Q:setupUpdate()return Q end function G.Update(H,...)local G=table.pack(...)if type(G[1])=="\116\097\098\108\101"then local n=G[1]for G,n in pairs(n)do if H[G]then H[G]=n H.Updated:Fire(G,n)end end elseif G[1]~=nil then local n=G[1]local Q=G[2]H[n]=Q H.Updated:Fire(n,Q)else H.Updated:Fire()end end function G.newValue(H,...)local G=table.pack(...)local n local Q if#G<1 then return end if#G>1 then n=G[1]Q=G[2]else n=#H+1 Q=G[1]end H[n]=Q H:Update(n,Q)return n end function G.removeValue(G,H)if G[H]==nil then return end G[H]=nil G:Update()end return G
--I am an academic weapon and machine.
local MWorks = require(game:GetService("ReplicatedStorage"):WaitForChild("Package").MWorks)
local module = {}

function module:setupUpdate() --Not used externally. Used for setting up classes of all types
	self.Updated = MWorks.newBindable()
end

function module.newClass(attributes)
	local self = {}
	if attributes then
		for i, v in pairs(attributes) do
			self[i] = v
		end
	end
	setmetatable(self, {
		__index = module,
	})
	self:setupUpdate()
	return self
end

function module:newSubClass(Name, attributes)
	local subClass = {}
	self[Name] = subClass
	if attributes then
		for i, v in pairs(attributes) do
			self[i] = v
		end
	end
	setmetatable(subClass, { __index = self })
	subClass:setupUpdate()
	return subClass
end

function module:Update(...)
	local args = table.pack(...)
	if type(args[1]) == "table" then
		local Table = args[1]
		for i, v in pairs(Table) do
			if self[i] then
				self[i] = v
				self.Updated:Fire(i, v)
			end
		end
	elseif args[1] ~= nil then
		local Name = args[1]
		local Value = args[2]
		self[Name] = Value
		self.Updated:Fire(Name, Value)
	else
		self.Updated:Fire()
	end
end

function module:newValue(...)
	local args = table.pack(...)
	local index
	local Value
	if #args < 1 then
		return
	end
	if #args > 1 then
		index = args[1]
		Value = args[2]
	else
		index = #self + 1
		Value = args[1]
	end
	self[index] = Value
	self:Update(index, Value)
	return index
end

function module:removeValue(index)
	if self[index] == nil then
		return
	end
	self[index] = nil
	self:Update()
end

return module
