Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is MouseEnter() and MouseLeave() for?

I am making a GUI for a RTS project, and I want a GUI to only appear when your mouse is over it. I came across MouseEnter() and MouseLeave(), but I don't know how to use them. Can someone please tell me what it's about so I can script the GUI? (I just want a general idea and the parameters it can hold, not a complete script)

Thanks,

mranderson11

1 answer

MouseEnter() and MouseLeave() are used to detect when the players mouse moves inside a TextButton, ImageLabel etc.

So if you wanted to change the colour of a button when you hovered over it, you'd use MouseEnter() to change it when the mouse is hovering over the button, and MouseLeave() to return the colour back to normal when your cursor left the button.

somebuttonorsomething.MouseEnter:connect(function)

is how it is used in an event listener.

1 comment

0

Thank you very much. I'll apply this on my GUIs to make them display another GUI when hovered, and remove it when the mouse leaves

This discussion is preserved as it was. New answers, comments, and votes are closed.