Basically, I want to trigger a function when the player's mouse is on a text button for 1 second or more. Is that possible and if so how?
COMMUNITY QUESTION
How do you test if the player's mouse is on a text button for a certain amount of time?
1 answer
Here is the code I made:
local Button = script.Parent.TextButton
local Wait = 0
function YourFunction()
print("Worked")
end
Button.MouseEnter:Connect(function()
wait(1)
Wait = 1
end)
Button.MouseLeave:Connect(function()
if Wait >= 1 then
YourFunction()
Wait = 0
else
Wait = 0
end
end)
1 comment
0
smh... Seriously, evaera make StackEdit compatible.....
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
You can use the GuiObject.MouseEnter Signal to Connect a Listener, from there, simply write wait(time) and the Code you'd like to function below.
https://scriptinghelpers.org/help/how-post-good-questions-answers