The problem is that wait function is sometimes very slow, i mean that 1/60 of second is not enough, so i decided make my own wait function, but i stomped on this error.
Any suggestions how can i make a wait function other the way?
coroutine.resume(coroutine.create(function()
local StartTime = tick()
local N = 0
local IterationsPerWait = 100
local function WaitTill(Time)
N += 1
if IterationsPerWait <= N then
N = 0
wait()
end
if tick() - StartTime >= Time then
return true
end
return WaitTill(Time)
end
WaitTill(CooldownsData[Type])
self.CurrentCooldowns[Type] = nil
end))