function Icon.setTip(S,V)assert(typeof(V)=="\115\116\114\105\110\103"or V==nil,"\069\120\112\101\099\116\101\100 \115\116\114\105\110\103\044 \103\111\116 "..typeof(V))local W=textService:GetTextSize(V,12,Enum.Font.GothamSemibold,Vector2.new(1000,14))S.instances.tipLabel.Text=V S.instances.tipFrame.Size=UDim2.new(0,W.X+6,0,20)S.instances.tipFrame.Parent=V and activeItems or S.instances.iconContainer S.tipText=V if S.hovering then S:_displayTip(true)end return S end function Icon._displayTip(S,V)local W=V local A=S.instances.tipFrame if S.tipText==nil then return elseif userInputService.TouchEnabled and not S._draggingFinger then return end if W==true then local function V(V,S)local W=V local y=S local R=workspace.CurrentCamera local m=R and R.ViewportSize if userInputService.TouchEnabled then local V=W-A.Size.X.Offset/2 local S=0 local R=m.X-A.Size.X.Offset local U=(y+THUMB_OFFSET)+60 local L=((A.AbsoluteSize.Y+THUMB_OFFSET)+64)+3 local E=m.Y-A.Size.Y.Offset W=math.clamp(V,S,R)y=math.clamp(U,L,E)elseif IconController.controllerModeEnabled then local V=TopbarPlusGui.Indicator local S=V.AbsolutePosition W=(S.X-A.Size.X.Offset/2)+V.AbsoluteSize.X/2 y=S.Y+90 else local V=W local S=0 local R=(m.X-A.Size.X.Offset)-48 local U=y local L=A.Size.Y.Offset+3 local E=m.Y W=math.clamp(V,S,R)y=math.clamp(U,L,E)end A.Position=UDim2.new(0,W,0,y-20)end local W=userInputService:GetMouseLocation()if W then V(W.X,W.Y)end S._hoveringMaid:give(S.instances.iconButton.MouseMoved:Connect(V))end for V,W in pairs(S._uniqueSettings.tip)do S:_update(W)end end
-- Tips
function Icon:setTip(text)
	assert(typeof(text) == "string" or text == nil, "Expected string, got " .. typeof(text))
	local textSize = textService:GetTextSize(text, 12, Enum.Font.GothamSemibold, Vector2.new(1000, 20 - 6))
	self.instances.tipLabel.Text = text
	self.instances.tipFrame.Size = UDim2.new(0, textSize.X + 6, 0, 20)
	self.instances.tipFrame.Parent = (text and activeItems) or self.instances.iconContainer
	self.tipText = text
	if self.hovering then
		self:_displayTip(true)
	end
	return self
end

function Icon:_displayTip(visibility)
	local newVisibility = visibility
	local tipFrame = self.instances.tipFrame
	if self.tipText == nil then
		return
	elseif userInputService.TouchEnabled and not self._draggingFinger then
		return
	end
	if newVisibility == true then
		-- When the user moves their cursor/finger, update tip to match the position
		local function updateTipPositon(x, y)
			local newX = x
			local newY = y
			local camera = workspace.CurrentCamera
			local viewportSize = camera and camera.ViewportSize
			if userInputService.TouchEnabled then
				--tipFrame.AnchorPoint = Vector2.new(0.5, 0.5)
				local desiredX = newX - tipFrame.Size.X.Offset / 2
				local minX = 0
				local maxX = viewportSize.X - tipFrame.Size.X.Offset
				local desiredY = newY + THUMB_OFFSET + 60
				local minY = tipFrame.AbsoluteSize.Y + THUMB_OFFSET + 64 + 3
				local maxY = viewportSize.Y - tipFrame.Size.Y.Offset
				newX = math.clamp(desiredX, minX, maxX)
				newY = math.clamp(desiredY, minY, maxY)
			elseif IconController.controllerModeEnabled then
				local indicator = TopbarPlusGui.Indicator
				local newPos = indicator.AbsolutePosition
				newX = newPos.X - tipFrame.Size.X.Offset / 2 + indicator.AbsoluteSize.X / 2
				newY = newPos.Y + 90
			else
				local desiredX = newX
				local minX = 0
				local maxX = viewportSize.X - tipFrame.Size.X.Offset - 48
				local desiredY = newY
				local minY = tipFrame.Size.Y.Offset + 3
				local maxY = viewportSize.Y
				newX = math.clamp(desiredX, minX, maxX)
				newY = math.clamp(desiredY, minY, maxY)
			end
			--local difX = tipFrame.AbsolutePosition.X - tipFrame.Position.X.Offset
			--local difY = tipFrame.AbsolutePosition.Y - tipFrame.Position.Y.Offset
			--local globalX = newX - difX
			--local globalY = newY - difY
			--tipFrame.Position = UDim2.new(0, globalX, 0, globalY-55)
			tipFrame.Position = UDim2.new(0, newX, 0, newY - 20)
		end
		local cursorLocation = userInputService:GetMouseLocation()
		if cursorLocation then
			updateTipPositon(cursorLocation.X, cursorLocation.Y)
		end
		self._hoveringMaid:give(self.instances.iconButton.MouseMoved:Connect(updateTipPositon))
	end
	-- Change transparency of relavent tip instances
	for _, settingName in pairs(self._uniqueSettings.tip) do
		self:_update(settingName)
	end
end
