vci.StartCoroutine( coroutine.create( function() print("Coroutine start") local i = 0 while i < 10 do -- Counts print(i) i = i + 1 -- Sleep for 0.5 seconds sleep(0.5) end print("Coroutine end") end ) ) function sleep(sec) local t0 = os.time() + sec while os.time() < t0 do -- Stop the coroutine coroutine.yield() end end