Replace wait() with SmartWait()
ArchLand64 opened this issue · comments
I recommend replacing your wait() calls with something like SmartWait():
local Heartbeat = game:GetService("RunService").Heartbeat
local function SmartWait(timeToWait)
timeToWait = timeToWait or 1/60
local timeElapsed = 0
while timeElapsed <= timeToWait do
local timeWaited = Heartbeat:Wait()
timeElapsed = timeElapsed + timeWaited
end
return timeElapsed
end
Clonetrooper demonstrates what can happen when using wait() on large scale projects here:
https://www.youtube.com/watch?v=cj_21dL_W38
Thank you for the suggestion!
From my current understanding, this sort of change would be of trivial effect to the stability and performance speed of ProfileService - wait()
is only used in places where even a 50% offset in wait time would make no apparent difference.