MouseLeave doesn't fire if you move mouse fast

Title says it all, but this results in bugs like these appearing in many of my GUIs:


because MouseLeave doesn’t fire.

It’s in multiple scripts that I havn’t edited in months so I’m certain it’s a roblox issue.
First noticed this behaivour yesterday.

30 Likes

I’ve noticed this before too (in multiple UI engines as well, not just Roblox). What I do to get around this (and same for MouseEnter) is to connect to InputChanged, listen for UserInputType==MouseMovement and treat that as a mouse enter that’ll fake a leave event to the others.

4 Likes

Thanks but this wasn’t an issue until roblox last update.
It’s a roblox bug that needs to be fixed, not worked around.

6 Likes

There have been issues with Ended events for multiple years. Are you sure it was just recently broken and not that you only noticed it now? You might need to work around it if you want a timely fix.

3 Likes

It was first in last update that another player told me it was happening to him, and it turned out to happen to alot of people.
They thought it was my new update but this bug replicates on places I have not updated and that’s why Im certain roblox did something.

2 Likes

I know we’re all aware that this has already been an existing issue but here are some older posts for proof:


I haven’t noticed any differences beyond MouseLeave’s usual buggy behavior, at least not yet.

3 Likes

These posts are all 1 year+
Alot of bugs are fixed to later re-appear.

Time to fix it again.

I don’t see why I would have to argue about this, it’s a core fundamental function that should always work, period.

4 Likes

We all believe that it’s an issue and that it should be fixed, we’re just trying to explain to you that it isn’t a new bug.

And in fact, I just tested some hover-based UIs in my game and they actually work better than they used to since I last tested MouseLeave (note: I did not test hovering between nearby buttons, only buttons on their own). I’ll look into this more when I get home.

1 Like

I’ve noticed this too; had GUI the other day that wasn’t having this issue, and now I got user reports of it today. I don’t think its just you.

3 Likes

Alright, well I suspect the issue happens if you enter another button ‘before leaving’ the first.

3 Likes

It’s most likely that, MouseLeave bugs usually happen when hovering between nearby buttons. I don’t have anything on hand to test this at the moment so perhaps you could test this and see if this is indeed a new MouseLeave issue.

IIRC MouseLeave wouldn’t fire if the player did something like switch windows or open the client menu while hovering over a button and moving their cursor to another location, these appear to have been fixed.

I guess I did have some UI on my laptop to to test with but it’s written to override MouseLeave events with MouseEnter so this is only reliable for proving that the window switch / menu issue I mentioned has been fixed, although I do notice that the custom cursor follows the mouse but MouseLeave is not triggered until the mouse moves while the game menu is closed.

2 Likes

If it’s of your intention, apply the rule that only one element can be selected.
When MouseEnter is fired, call the function you connected to MouseLeave for the last selected ui, or make a selection ui under the selectable uis that tweens to your target.
I once used MouseMoved to detect the position of the mouse, and accordingly place the selection ui with math.floor.

1 Like

im getting the same thing. you can actually replicate this bug with the roblox backpack gui; try dragging a tool around quickly and it’ll get stuck. this was not happening before, tested it with multiple users.

2 Likes

We may have released a feature that made this bug more prevalent. I’m going to look into this, but long term we have plans to rewrite a lot of this code to make it more robust. When we get to shipping this I’ll make sure it is in the changelog

10 Likes

This definitely a recent issue.

I’m having the same problems with my games. No changes to my code, but hover animations on my buttons are getting stuck in hover mode even when my mouse is moved away.

2 Likes

This is a big issue, I’ve been getting so many UI bug reports for my game lately because of this - and I can’t do anything about it unless I work around it, which really should not be necessary.

6 Likes

Is there an ETA on the patch? This happens frequently in Adopt Me and our players are noticing

1 Like

I hope there’s a patch soon… this is kind of breaking my game in a lot of ways :confused:

2 Likes

I notice this as well, it won’t call MouseLeave when I move the mouse quickly on this simple script I made.

2 Likes

I think this is a big issue since it’s one of the basic features of UI design.
Not only that, but it’s visible in almost every game on ROBLOX. Players who run into this oddly unappealing bug assume it’s the developer’s fault and complain about it, which would also affect the game’s ratings.

These kind of features, in my opinion, should be more reliable.

3 Likes