I have a TextBox and I want it to time the amount of time it takes to type in a certain piece of text, however, whenever I have used the 'Changed' function it just starts multiple timers every time the TextBox has changed. This is what I have come up with so far but can't figure out the rest. (Local script)
Code:
01 | local timer = 0 |
02 |
03 | script.Parent.enterText.Changed:Connect( function () |
04 | while timer < 60 do |
05 | if timer > 1 then |
06 | print ( "Timer started" ) |
07 | wait( 1 ) |
08 | timer = timer + 1 |
09 | else |
10 | timer = timer + 1 |
11 | end |
12 | end |
13 | end ) |
You can do this using the Focused
event.
1 | -- Simplified version |
2 | local timer = 0 |
3 |
4 | script.Parent.enterText.Focused:Connect( function () |
5 | for i = 0 , 60 do |
6 | timer = i + 1 |
7 | wait( 1 ) |
8 | end |
9 | end ) |