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

How to detect if the player has moved their mouse over the button?

im trying to make it so that when the player hovers their mouse over the button that has the localscript inside of it, it doesnt work

local button = script.Parent

button.CursorHover:Connect(function()
button.Text = "lol"
end)

1 answer

✓ Accepted answer

You were very close! However, some of your syntax must be fixed in order for this to work.

local button = script.Parent

button.MouseEnter:Connect(function()
button.Text = "lol"
end)

In that same very script, you can also use another function that detects when the player has moved their mouse off of the button.

button.MouseLeave:Connect(function()
button.Text = "Previous Text|Desired Text"
end)

3 comments

0

would i use this in a regular script or a localscript

1

Local.

0

thanks

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