hexon7575
|
  |
| Joined: 09 Oct 2010 |
| Total Posts: 210 |
|
|
| 05 Sep 2016 11:55 AM |
| I need a script that adds 1 to a number value until it reaches 10 while the left mouse button is held down. If the left mouse button is un-clicked, it resets and stops counting until its held down again. How would I do this? I've been trying for literal hours. |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 05 Sep 2016 12:01 PM |
| What is the user clicking? A brick? A gui? Different methods for different circumstances |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2016 12:14 PM |
local Player = game:GetService("Players").LocalPlayer local Mouse = Player:GetMouse()
local MouseHolding = false local IncrementSpeed = 0.5 local numValue = 0
Mouse.Button1Down:connect(function() MouseHolding = true end) Mouse.Button1Up:connect(function() MouseHolding = false numValue = 0 end)
while IncrementSpeed do if MouseHolding then if numValue < 10 then numValue = numValue + 1 end end end
|
|
|
| Report Abuse |
|
|
|
| 05 Sep 2016 12:16 PM |
:GetMouse() Is deprecated.
I don't advise you use that. |
|
|
| Report Abuse |
|
|