So i have a gui button and i want to create a easter egg function by clicking and holding it for 2 second This is a script i currently have in my mind
1 | script.Parent.MouseButton 1 Down:Connect( function () |
2 | if script.Parent.MouseButton 1 Up then |
3 | else |
4 | wait( 3 ) |
5 | --Secret function |
6 | end |
7 | end ) |
Idk if that works. Is there a better way of doing this ? Thanks for reading, hope you could help :D
01 | script.Parent.MouseButton 1 Down:Connect( function () |
02 | local isholding = true |
03 | script.Parent.MouseButton 1 Up:Connect( function () |
04 | isholding = false |
05 | end ) |
06 | wait() |
07 | if isholding then |
08 | --Secret Function |
09 | end |
10 | end ) |