Detect when mouse is hovering over a TextButton

Is there a way to detect when a player is hovering over a TextButton? Yes, I know MouseEnter/MouseLeave exists but I want to run a function and detect if the player is still hovering over the TextButton.

1 Like

I think you would have to use those events and change a variable. When the mouse enters, set it to true, and when it leaves, set it to false.

1 Like

you can just set a variable that mouse hovering
example :
local hovering = false
script.Parent.MouseEnter:Connect(function()
hovering = true
end)
script.Parent.MouseLeave:Connect(function()
hovering = false
end)

this code changes the hovering value to true if mouse is on the textbutton. you can check if hovering = true , and then do whatever you want!

i hope this helps

7 Likes