i have a delayRate variable which is set to 3000
delayRate = 3000
then i have a gameLoopTimer variable which i declare at the very end of my code
local gameLoopTimer
gameLoopTimer = timer.performWithDelay(delayRate, gameLoop, -1 )
i tried to make a simple function that would decrease this delay rate
local function delayRateDecrease() delayRate = 3000 if (score == 5) then delayRate = delayRate - 2900 end end
within this function is also where the delayRate is set equal to some value.
when i try to call the function in the gameLoopTimer in place of delayRate i receive an error
i tried several other basic things as well but even if the code runs without error it seems the delayRate doesn’t change
the Error i receive is “?:0 attempt to perform arithmetic on a nil value”