lars.oj.lindner Posted December 16, 2025 Posted December 16, 2025 I have a lua function that I want to call each 10 seconds but I don’t now how to in simrail. the closet thing I hav come across is the PerformUpdate function but that does not fel right since it is called each frame. is there another way to accomplice this?
lewnemejski Posted December 16, 2025 Posted December 16, 2025 (edited) CreateCoroutine(function () while true do MyFunction() coroutine.yield(CoroutineYields.WaitForSeconds, 10) end end) Maybe something like this? Edited December 16, 2025 by lewnemejski 1
lars.oj.lindner Posted December 17, 2025 Author Posted December 17, 2025 I have tried that before with no success but when placing the function in EarlyScenarioStart it worked. Thankyou.
lewnemejski Posted December 17, 2025 Posted December 17, 2025 1 hour ago, lars.oj.lindner said: I have tried that before with no success but when placing the function in EarlyScenarioStart it worked. Thankyou. Because CreateCoroutine need to be inside of a function. Cannot be placed outside.
Recommended Posts