I created a timer… I cancel the timer when a value > 70 but for some reason while it stops it throws this error afterwards continuously as if the timer is still firing…
bad argument #1 to ‘cancel’ (number expected, got nil)
stack traceback:
[C]: in function ‘cancel’
The use of a keyboard command is just placeholder to fire the timer function so I can test the underlying code but maybe it’s a byproduct of too many key presses firing? That’s why I gated it with the barvalue=25
if action_id == hash("HotKeyJ") and barvalue==25 then
local pbar_timer = timer.delay(0.05, true, function()
barvalue = barvalue + 1
if barvalue > 70 then
stopped = timer.cancel(pbar_timer)
end
UIUpdatedProgressBar("HealthBar1", Values.Value[1].Label, barvalue, 0, 100, 70, "comments", "healthicon.png")
end)
end