MouseEnter and MouseLeave are extremely glitchy

They generally don’t work very well, here’s an example scenario:

You have a TextButton witha MouseButton1Click, MouseEnter and MouseLeave function.

MouseEnter makes the TextButton.BackgroundTransparency 0.5
MouseLeave resets the TextButton.BackgroundTransparency to 0
MouseButton1Click prints “hi”

You hover over the TextButton, it’ll already give strange, random results after repeating this process a few times.

You hover over the TextButton, then click while on it.
it prints “hi”

You move away from the TextButton, it resets fine.

You click fast, and while clicking and holding the mouse button down you hover outside the TextButton, firing MouseButton1Click but not MouseLeave, causing very unwanted results.

 -- Local script
 local ui = script.Parent

      ui.BackgroundTransparency = 0.5

      ui.BackgroundTransparency = 0

1 Like

I’ve experienced this too when I use MouseEnter and MouseLeave to display tooltips. Sometimes the UI stays visible when the player no longer has their mouse over the UI element

1 Like

Indeed, this proves the same point.

Yep, we’ve reported this before and if I recall correctly, the response was that it’s really difficult (or complicated?) to actually check the MouseEnter/MouseLeave and that there wasn’t a good way to do it. I don’t know if that’s changed now, and I can’t really remember the thread, it really was years ago.

MouseEnter/MouseLeave have always had problems. @Sharksie is fixing these issues though IIRC, but maybe he hasn’t pushed his changes to production yet, or maybe they’re pending release.

also something that doesn’t work correctly even now. Any news on this @Sharksie?

Edit: didn’t mean to reply to u :stuck_out_tongue:

use @ScriptOn 's custom solution if it’s vital

(gj scripton)

Mind linking?