Hey, so I have been trying to make a script that decreases a variable's value while the mouse is holding button 1, the mouse section was easy, but I can't find a way to make the value decrease when mouse is holding, While true do keep decreasing and it won't stop, the minimum value is 0, can someone help?
local Mouse = player:GetMouse()
local value = 100 -- value supposed to reduce when mouse is being hold
function OnHoldRapid()
end
Mouse.Button1Down:Connect(OnHoldRapid)
function OnFree()
end
Mouse.Button1Up:Connect(OnFree)
Thank you!

6 comments
I'm not sure on this, so feel free to correct me on this anyone, but I believe Button1Down would only count 1 time on 1 "hold".
hey robloxknight2000, Button1Down is supposed to trigger a functions that keep repeating, but i don't know how i would stop it, so i guessed i would need a Button1Up to stop it or something...
Yeah, judging by the DevHub article on it, and their examples, it'll only fire once, meaning it won't be able to decrease to 0. https://developer.roblox.com/api-reference/event/Mouse/Button1Down
i have no idea on how to do this then...
You could try making a loop?
how exactly?