Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is MouseEnter() and MouseLeave() for?

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

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.

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 TheArmoredReaper 173 — 10y
Ad

Answer this question