I've seen this as the "Tip of the Day" but I forgot it. I'm sure someone knows; care to help?
✓ ANSWER ACCEPTED
What is faster than "wait()"?
2 answers
✓ Accepted answer
It's the RenderStepped event of the RunService. This event fires every render frame, which is approximately 1/60th of a second. You can use it like a normal event (which will basically behave like a really fast loop, since the event is constantly firing.)
game:GetService("RunService").RenderStepped:connect(function()
print("Spamming your output...")
end)
Or simply use the wait() method, which will wait for the event to be fired until continuing.
while true do
print("Spamming your output...")
game:GetService("RunService").RenderStepped:wait()
end
In a repeat loop, it's the same.
repeat
print("Spamming your output...")
game:GetService("RunService").RenderStepped:wait()
until
condition
This can only be used in a LocalScript.
here are some things faster than wait:
while true do
print("thing")
coroutine.yield()
end
runservice.RenderStepped:connect(function()
print("thing")
end)
runservice.Heartbeat:connect(function()
print("thing")
end)
local counter = 1
while true do
print("thing")
if counter == 2 then
counter = 1
coroutine.yield()
else
counter = counter + 1
end
end
1 comment
0
coroutine.yield() methods don't work sadly
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
Can you show a way how to implement it in a "repeat wait() until true" script?
Read it now.
Thanks!
Don't forget to put a Wait() after a While True Do statement to stop the client from crashing!
Waiting for the RenderStepped event to fire is sufficient to keep your client from crashing.
Does "while game:GetService("RunService").RenderStepped:wait() do" work? I've done "while wait() do", so...