I have seen so many people face issues with GuiObject mouse events not firing, leaving their UI sad
Sources
Extend MouseEnter/MouseLeave (GuiObject) to fire in more scenarios
GuiObject.MouseLeave not firing as expected [Only occurring with the input device being mouse]
.MouseEnter/.MouseLeave not fired on UI Frames when scrolled - #11 by 7eoeb
This only works with ScreenGuis, if you need reliable Mouse Events for SurfaceGui, click here
Showcase 
Roblox’s MouseEvents (BAD)
My MouseEvents (GOOD)
Another Comparison
The main advantage: ScrollingFrames
The most common report is that it doesn’t fire when scrolling through frames. This is because the engine only checks wether the user is hovering over a GuiObject every time the mouse moves, not every frame. My version fixes this (shown in the first video).
Other advantages
- No more issues where MouseLeave randomly doesn’t fire
- Works with CoreGui open
How to use
Just require the module and call the .new()
function, passing in the GuiObject. You’ll get two RBXScriptSignals (mouseEnter
, mouseLeave
).
Example code:
local ScrollingFrame = script.Parent
local MouseEvents = require(script.MouseEvents)
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(0.15)
for _, v in ScrollingFrame:GetChildren() do
if v:IsA("ImageButton") then
local enter, leave = MouseEvents.new(v)
enter:Connect(function()
TweenService:Create(v, info, {BackgroundColor3 = Color3.fromRGB(235, 235, 235)}):Play()
TweenService:Create(v.UIStroke, info, {Thickness = 2}):Play()
end)
leave:Connect(function()
TweenService:Create(v, info, {BackgroundColor3 = Color3.fromRGB(255, 255, 255)}):Play()
TweenService:Create(v.UIStroke, info, {Thickness = 0}):Play()
end)
end
end
Real world example: robloxOS
A while ago I implemented this module into my own game, and want to link it here so you can see what it is like. Link: robloxOS
Links:
Module
Testing Place - Play
mouseEventsOctober52025.rbxl (94.4 KB)
You must leave the credit print statement. Thank you!
Have any bugs? Any issues? Not what you’re looking for?
Feel free to DM me or reply on this thread!
Reply with cool effects you’ve made