I’m asking beacuse i don’t know does it make any sense to make another wait function in order to make it more accurate.
local function Sleep (T)
local RS = game:GetService("RunService")
local S = tick()
RS.RenderStepped:Connect(function()
if T > tick()-S then
end
end)
end
Any increase in accuracy from using tick() is probably nominal at best. Honestly, you’re probably better off just using wait() rather than calling a function and running a loop.
This should be accurate, but the fact is that RunService events are the fastest at yielding. Use Event:Wait() instead of connecting a function, unless it was necessary for something else.
Hm, yeah, as the others said, wait() is not really accurate. I even had a function that basically did the work in a better way without needing to use wait().
local RunService = game:GetService("RunService")
function WAIT(t)
t = t or 0
local start = tick()
repeat
RunService.Stepped:Wait()
until (tick() - start) >= t
end