I made a tool where if I hold it down, it increases a value. It works, but if I spam click it and immediately hold the mouse button down the value increases rapidly as if I never put a wait() there.
Here is my code:
script.Parent.Activated:Connect(function() script.Parent.Charging.Value = true while script.Parent.Charging.Value==true do if script.Parent.Charging.Value==false then break end script.Parent.Charge.Value = script.Parent.Charge.Value +10 print ("obama") wait(1) if script.Parent.Charging.Value==false then break end end end) script.Parent.Deactivated:Connect(function() print ("Nobama") script.Parent.Charging.Value = false wait(0.5) script.Parent.Charge.Value = 0 end)