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

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

Asked by 2 years ago

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

Log in to vote
2
Answered by
2_MMZ 1059 Moderation Voter
2 years ago

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)
0
would i use this in a regular script or a localscript Pencil_Supply 67 — 2y
1
Local. 2_MMZ 1059 — 2y
0
thanks Pencil_Supply 67 — 2y
Ad

Answer this question