So i’ve used this function in another script, however now i do not know why or understand why its not working. I have a nil value somewhere, it isnt in the parameters so im just not sure where to go from here.
function speed_delay(self)
timer.delay(3, false, function()
end)
speed = speed - 40
end
Any help appreciated thanks
Error msg: attempt to index upvalue ‘timer’ (a nil value)
I now don’t get the error so thanks for very much for that. However, now the timer itself doesnt slow down the problem. The speed is immediately reduced without the 3 second delay.
I tried the speed = speed - 40 within the “abstract function”? I’m not sure if that is what it is called, but then it doesn’t reduce the speed at all. Do you know if you can help at all?
Unfortunately, its not the speed variable as anything i put in the inline function, like a print statement, none of them work. Not sure where to go from here but thanks for the help
Oh I didnt realise that it was linked to the game object, how silly of me. I’ll pass a msg into the script of the game object that I’m trying to slow down instead.
Thanks
Not silly at all, I get caught out the same way from time to time. I think I conceptualise the timer as a separate entity from the script so I forget that the two are linked.