Timer.delay() returns nil handle (SOLVED)

a is undefined here. Actually, this is different global undefined variable, not your “a”.
Do this instead:

local a
a = timer.delay(5, true, function ()
--after some time
timer.cancel(a)
end)
5 Likes