DEFAULT_FORCED_GROUP_VALUES.caption=1 function Icon.setCaption(v,G)assert(typeof(G)=="\115\116\114\105\110\103"or G==nil,"\069\120\112\101\099\116\101\100 \115\116\114\105\110\103\044 \103\111\116 "..typeof(G))v.captionText=G v.instances.captionLabel.Text=G v.instances.captionContainer.Parent=G and activeItems or v.instances.iconContainer v:_updateIconSize(nil,v:getIconState())local d=Maid.new()v._maid.captionMaid=d d:give(v.hoverStarted:Connect(function()if not v.isSelected then v:displayCaption(true)end end))d:give(v.hoverEnded:Connect(function()v:displayCaption(false)end))d:give(v.selected:Connect(function()if v.hovering then v:displayCaption(false)end end))local l=v.instances.iconContainer d:give((l:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\083\105\122\101")):Connect(function()if v.hovering then v:displayCaption()end end))d:give((l:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\080\111\115\105\116\105\111\110")):Connect(function()if v.hovering then v:displayCaption()end end))v:displayCaption(v.hovering)return v end function Icon.displayCaption(v,G)if userInputService.TouchEnabled and not v._draggingFinger then return end local d=8 if v._draggingFinger then d=d+THUMB_OFFSET end local l=v.instances.iconContainer local C=v.instances.captionContainer local N=UDim2.new(0,(l.AbsolutePosition.X+l.AbsoluteSize.X/2)-C.AbsoluteSize.X/2,0,(l.AbsolutePosition.Y+l.AbsoluteSize.Y*2)+d)C.Position=N local O=v.captionVisible or false if typeof(G)=="\098\111\111\108\101\097\110"then O=G end v.captionVisible=O local f=v:get("\099\097\112\116\105\111\110\070\097\100\101\073\110\102\111")for G,d in pairs(v._groupSettings.caption)do local l=v._settingsDictionary[d]l.useForcedGroupValue=not O v:_update(d)end end

DEFAULT_FORCED_GROUP_VALUES["caption"] = 1

function Icon:setCaption(text)
	assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
	self.captionText = text
	self.instances.captionLabel.Text = text
	self.instances.captionContainer.Parent = (text and activeItems) or self.instances.iconContainer
	self:_updateIconSize(nil, self:getIconState())
	local captionMaid = Maid.new()
	self._maid.captionMaid = captionMaid
	captionMaid:give(self.hoverStarted:Connect(function()
		if not self.isSelected then
			self:displayCaption(true)
		end
	end))
	captionMaid:give(self.hoverEnded:Connect(function()
		self:displayCaption(false)
	end))
	captionMaid:give(self.selected:Connect(function()
		if self.hovering then
			self:displayCaption(false)
		end
	end))
	local iconContainer = self.instances.iconContainer
	captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
		if self.hovering then
			self:displayCaption()
		end
	end))
	captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
		if self.hovering then
			self:displayCaption()
		end
	end))
	self:displayCaption(self.hovering)
	return self
end

function Icon:displayCaption(bool)
	if userInputService.TouchEnabled and not self._draggingFinger then return end
	local yOffset = 8
	
	-- Determine caption position
	if self._draggingFinger then
		yOffset = yOffset + THUMB_OFFSET
	end
	local iconContainer = self.instances.iconContainer
	local captionContainer = self.instances.captionContainer
	local newPos = UDim2.new(0, iconContainer.AbsolutePosition.X+iconContainer.AbsoluteSize.X/2-captionContainer.AbsoluteSize.X/2, 0, iconContainer.AbsolutePosition.Y+(iconContainer.AbsoluteSize.Y*2)+yOffset)
	captionContainer.Position = newPos

	-- Determine caption visibility
	local isVisible = self.captionVisible or false
	if typeof(bool) == "boolean" then
		isVisible = bool
	end
	self.captionVisible = isVisible

	-- Change transparency of relavent caption instances
	local captionFadeInfo = self:get("captionFadeInfo")
	for _, settingName in pairs(self._groupSettings.caption) do
		local settingDetail = self._settingsDictionary[settingName]
		settingDetail.useForcedGroupValue = not isVisible
		self:_update(settingName)
	end
end
