--!strict local Types = require(script.Parent.Types) local Scoring = {} function Scoring.new(state: Instance, onAdd: ((Types.Side, number, string?, Player?) -> ())?): Types.Scoring local score: {[Types.Side]: number} = {Blue = 0, Orange = 0} state:SetAttribute("BlueScore", 0) state:SetAttribute("OrangeScore", 0) return { add = function(side, points, reason, credit) score[side] += points state:SetAttribute(side .. "Score", score[side]) if onAdd then onAdd(side, points, reason, credit) end end, get = function(side) return score[side] end, } end return Scoring