function TextMaskClass.GetValue(k)return k._MaskType:ToType(k.Frame.Text)end function TextMaskClass.GetMaskType(k)return k._MaskType.Name end function TextMaskClass.SetMaxLength(h,k)h._MaxLength=k end function TextMaskClass.SetMaskType(h,k)local M=MASKS[k]if not M then M=MASKS.String warn(WARN_MSG:format(k))end h._MaskType=M h.Frame.Text=(M:Process(h.Frame.Text)):sub(1,h._MaxLength)if k=="\078\117\109\098\101\114"then h.Frame.Text=0 h.IncrementButton=INCREMENT_BUTTON:Clone()h.IncrementButton.AnchorPoint=Vector2.new(1,0)h.IncrementButton.Position=UDim2.new(1,0,0,0)h._Maid:Mark(h.IncrementButton.Activated:Connect(function()h.Frame.Text=tonumber(h.Frame.Text)+1 end))h.IncrementButton.Parent=h.Frame h._Maid:Mark(h.IncrementButton)h.DecrementButton=DECREMENT_BUTTON:Clone()h.DecrementButton.AnchorPoint=Vector2.new(1,1)h.DecrementButton.Position=UDim2.new(1,0,1,0)h._Maid:Mark(h.DecrementButton.Activated:Connect(function()h.Frame.Text=tonumber(h.Frame.Text)-1 end))h.DecrementButton.Parent=h.Frame h._Maid:Mark(h.DecrementButton)end end function TextMaskClass.Destroy(k)k._Maid:Sweep()end


function TextMaskClass:GetValue()
	return self._MaskType:ToType(self.Frame.Text)
end

function TextMaskClass:GetMaskType()
	return self._MaskType.Name
end

function TextMaskClass:SetMaxLength(len)
	self._MaxLength = len
end

function TextMaskClass:SetMaskType(name)
	local mask = MASKS[name]
	if (not mask) then
		mask = MASKS.String
		warn(WARN_MSG:format(name))
	end
	self._MaskType = mask
	self.Frame.Text = mask:Process(self.Frame.Text):sub(1, self._MaxLength)
	
	-- Add increment/decrement buttons for numeric inputs
	if name == "Number" then
		-- Initialize text to 0, consumer can override
		self.Frame.Text = 0

		self.IncrementButton = INCREMENT_BUTTON:Clone()
		self.IncrementButton.AnchorPoint = Vector2.new(1, 0)
		self.IncrementButton.Position = UDim2.new(1, 0, 0, 0)
		self._Maid:Mark(self.IncrementButton.Activated:Connect(function()
			self.Frame.Text = tonumber(self.Frame.Text) + 1
		end))
		self.IncrementButton.Parent = self.Frame
		self._Maid:Mark(self.IncrementButton)
		
		self.DecrementButton = DECREMENT_BUTTON:Clone()
		self.DecrementButton.AnchorPoint = Vector2.new(1, 1)
		self.DecrementButton.Position = UDim2.new(1, 0, 1, 0)
		self._Maid:Mark(self.DecrementButton.Activated:Connect(function()
			self.Frame.Text = tonumber(self.Frame.Text) - 1
		end))
		self.DecrementButton.Parent = self.Frame
		self._Maid:Mark(self.DecrementButton)
	end
end

function TextMaskClass:Destroy()
	self._Maid:Sweep()
end
