--- Tooltip



return function(element, tooltipText)
	--- Cancel if this is on mobile
	if _L.Variables.Mobile then
		return false
	end
	
	--- Variables
	local events = {}
	local tooltip
	local cancel
	
	--- Create tooltip folder (if it doesn't already exist)
	local tooltipFolder = PlayerGui:FindFirstChild("TooltipsFolder")
	if tooltipFolder == nil then
		tooltipFolder = Instance.new("ScreenGui")
		tooltipFolder.Name = "TooltipsFolder"
		tooltipFolder.DisplayOrder = 999
		tooltipFolder.Parent = PlayerGui
	end
	
	--- (Function) remove tooltip
	local function remove()
		if tooltip then
			tooltip:Destroy()
			tooltip = nil
		end
	end
	
	--- (Function) create tooltip
	local function create()
		--- Remove any existing tooltips
		tooltipFolder:ClearAllChildren()
		
		--- Create tooltip
		tooltip = Instance.new("TextLabel")
		tooltip.BorderSizePixel = 0
		tooltip.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35)
		tooltip.TextColor3 = Color3.new(1, 1, 1)
		tooltip.FontSize = Enum.FontSize.Size18
		tooltip.Font = Enum.Font.Highway
		tooltip.Text = tooltipText
		
		--- Calculate size
		local textSize = _L.Services.TextService:GetTextSize(tooltip.Text, tooltip.TextSize, tooltip.Font, Vector2.new(175, 1000))
		tooltip.Size = UDim2.new(0, textSize.X + 4, 0, textSize.Y + 2)
		
		--
		tooltip.Parent = tooltipFolder
		
		--- Main
		while not cancel and tooltip and tooltip.Parent and element do
			--- Get positions
			local mouseX, mouseY = _L.Player.Get("Mouse").X, _L.Player.Get("Mouse").Y
			local guiSizeX, guiSizeY = element.AbsoluteSize.X, element.AbsoluteSize.Y
			local guiPosX, guiPosY = element.AbsolutePosition.X, element.AbsolutePosition.Y
			
			--- Is mouse still over? Should tooltip stay active?
			if (mouseX > guiPosX - 10) and (mouseX < guiPosX + guiSizeX + 10) and (mouseY > guiPosY - 10) and (mouseY < guiPosY + guiSizeY + 10) then
				--- Mouse
				local mouse = _L.Player.Get("Mouse")
				
				--- Change tooltip position (to follow mouse)
				tooltip.Position = UDim2.new(0, (mouse.X + 17), 0, mouse.Y)
			
			else
				--- Mouse is no longer over. CANCEL!
				cancel = true
			end
			
			--- Wait
			_L.Services.RunService.RenderStepped:wait()
		end
		
		--- Dispose
		remove()
	end
	
	--- Mouse events
	events[#events + 1] = element.MouseEnter:Connect(function()
		--- Mouse entered, create tooltip
		remove()
		create()
	end)
	--
	events[#events + 1] = element.MouseLeave:Connect(function()
		--- Mouse exited, remove tooltip
		remove()
	end)
	
	--- Return function to cancel this behavior
	return function()
		--- Clear events
		for _, event in ipairs(events) do
			event:disconnect()
		end
		events = nil
		
		--- Cancel
		cancel = true
	end
end
