Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How could someone count for how long the tool was activated?

Asked by 5 years ago
Edited 5 years ago

Hello, so I am trying to make something in a tool that tells you for how long the left mouse button was pressed. The only idea I could come up with was to make a loop that activates on the Mouse.Button1Down event and counts in 0.1 seconds. Then I would break that loop and just use the information that I got in the Mouse.Button1Up part. However I can't break the loop. So, any better ways of doing this or just a way to break the loop when the left button goes up?

0
I'd look into using tick() for getting the time between click and .... "unclick" ... could also use os.time() but i don't think that is necessary due to you not needing accurate times ForeverBrown 356 — 5y
0
Would you want the count to display as well? spot6003 64 — 5y
0
@ForeverBrown yeah that part isn't the problem i just got a variable named timer and then did a loop with wait(0.1) and timer = timer + 1 SRdeagle 7 — 5y
0
@spot6003 Do you mean like print? Anyways i just need the end resoult of how long the button was held down to use in the mouse.Button1Up part SRdeagle 7 — 5y
0
Like as a display for the people to see spot6003 64 — 5y

Answer this question