Wait function lua

any1 know how to make wait function in lua cuz i have no idea thanks for help

1 Like
function wait(time, callback)
    if not StartTime then
        StartTime = globals.curtime
    end
    if StartTime < globals.curtime + time then
        pcall(callback)
        StartTime = StartTime + time
    end
end
wait(0.5, function()
    print("YAY it works!")
end)