MouseHoverEnter without a clickdetector?

hey i’m using click detectors to make it so if you hover over some specific items it will create a highlight in them and then of course disables it when you look away

the problem is tools, if you hover over something and equip a tool then look away, the highlight will stay there because MouseHoverLeave doesn’t trigger if you have a tool equipped

any alternatives?

You can optimally use the following system:

local Mouse = Player:GetMouse()

local CurrentlyHighlighting = nil
local Tag = "Highlightable"

Mouse:GetPropertyChangedSignal("Target"):Connect(function()
	if CurrentlyHighlighting then
		if CurrentlyHighlighting:HasTag(Tag) then
			-- run highlight destroyer stuff
		end
	end
	if Mouse.Target:HasTag(Tag) then
		CurrentlyHighlighting = Mouse.Target
		-- run highlight creation stuff
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.