MouseHoverEnter and MouseHoverLeave are Unreliable, Looking for Alternatives

I’ve been working on a game that relies pretty heavily on Click Detectors. I’ve been using MouseHoverEnter and MouseHoverLeave, but I’ve been noticing that they are pretty unreliable.

I have it setup so that when the players mouse hovers over a cube, it creates a highlight instance in the cube and enables a BillboardGUI. Technically, it does work, but only about half the time, and only if you are looking the cubes from a very specific angle. Does anyone have an easy alternative to MouseHoverEnter and MouseHoverLeave that’s actually reliable and easy to implement?

try using mouse.Target
example

local mouse = game.Players.LocalPlayer:GetMouse()
mouse:GetPropertyChangedSignal("Target"):Connect(function()
print(mouse.Target)
end)
2 Likes

this^

check if target is a cube, set other cubes highlight off and disable the billboard gui

1 Like

I found that you have to create a new highlight instance rather than just enabling them. When there are large numbers of them (even disabled) they begin to bug out.

how many is large number?

anyway, you should then just create a new highlight for the target cube and remove any highlights on existing cubes

Well theres about 34 unique cubes so far, and they spawn in randomly, so there will be quite a few in the game. In my previous script, when the player hovered over a cube, it would create the highlight instance, and on MouseHoverLeave, it would destroy it.

if you just need one highlight to be visible don’t create a bunch of them, instead make one and set its adornee to the part you need highlighted

I completely forgot you can do that. I’ll definitely give that a try.