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

something when the mouse hovers?

Asked by 9 years ago

How do you do something when the mouse hovers over a Gui? What is the function you would set up for it?

1 answer

Log in to vote
2
Answered by 9 years ago

For this, simply use the handle MouseEnter and MouseLeave events.

--Example Script
local Button = script.Parent
Button.BackgroundColor3 = Color3.new(1, 0, 0)
Button.MouseEnter:connect(function()
    Button.BackgroundColor3 = Color3.new(1, 1, 1)
end)
Button.MouseLeave:connect(function()
    Button.BackgroundColor3 = Color3.new(1, 0, 0)
end)

That script will change a button's background color to white when the mouse is over it, and red (I think) when the mouse is not over the button. Hope this helps :)

0
thx! jimborimbo 94 — 9y
Ad

Answer this question