I want to figure out how to press and hold a button (On a SurfaceGUI).
If the button has been held down for at least 2 seconds I want it to bring a submenu (I have something for this already, and it’s submenu UI and animation)
This is an example of IOS’ menu.
I do not know how I can make the script see that I’m pressing and holding the textbutton for at least 2 seconds.
This is the button on the SurfaceGUI
If you require further explainations, I will try that. My explainations are not the best.
For this use
local timeBetween = 0
local down = false
down = true
timeBetween += 1
until timeBetween == 2 or down == false
if timeBetween ~= 2 then return end
print("Mouse was held down on button for 2s")
timeBetween = 0
down = false
BTW, this was written on mobile so it is untested (but should check to see when the button was held for 2 seconds) and could contain errors
You can use the MouseButton1Down and MouseButton1Up events to check for how long the mose has been held down for.
Thanks it worked for me perfectly as I needed it to be