Recently I’ve been heavily looking into performance and how to make my game run better, and I’m using a while true loop and I was wondering if this alternative would help efficiency wise.
The Alternative
local function WhileTrue()
--Code Here
task.wait(15)
WhileTrue()
end
WhileTrue()
There is no difference in efficiency, however I recommend using the local function method, this way you can call the loop whenever you want, while the second one will only happen when the script is first run and will yield the whole script forever. If you want to make other processes happen while the loop is going, use coroutines to create new threads