Since I have seen some conversations around the topic, I was wondering if repeat wait() is actually as bad as people say?
Just to clarify, I don’t use wait() in the repeat wait. I always do wait(.5) or wait(.1) or wait(1).
Since I have seen some conversations around the topic, I was wondering if repeat wait() is actually as bad as people say?
Just to clarify, I don’t use wait() in the repeat wait. I always do wait(.5) or wait(.1) or wait(1).
I don’t think it’d be “bad”, as long as you implement some sort of long delay I suppose you should be fine
You could also compare 2 values using RunService
’s Events, & quickly checking if the “NewValue” is greater than the number you want to detect for using tick()
(Which I don’t know would be more efficient or not)
local RunService = game:GetService("RunService")
local Connection
wait(30) --Or add some delay before starting the current time & checking its difference
local CurrentTime = tick()
local function BreakLoop()
local Difference = tick() - CurrentTime
if Difference > 3 then
Connection:Disconnect()
end
end
Connection = RunService.Heartbeat:Connect(BreakLoop)
I am not exact if this would entirely work, but it’s just a thought on what you could do for a more efficient “loop” checker I suppose
It’s only bad if you care about the downsides.
Remember that the reason people are doing RunService.Stepped:Wait()
and similar is because the thread scheduler (the one that makes wait(), spawn(), delay(), Debris etc. work) can sometimes throttle for unexpectedly long. Like a wait(2) waiting for 5 seconds instead. This leads to bullet hole decals on walls staying for too long, and other oddities.
The thing is, if you don’t care about that- if you just want your wait(1) loop to just run at whatever rate, and it’s not meant to be an actual seconds timer/clock- then you have nothing to fear. You can keep using wait loops.
The people running into this issue had been using LOTS of timers as well. If you’re not going nuts with these timers, then you’re also good.