Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

wait(1/60) is look like a Render Stepped?

Because, i was figuring out, but it's seems looks like a Render stepped from Run Service. But What he does do it?

-- This is example code of Zoom in Smoothly
for i = math.huge, 1, -1 do
		wait(1/60) -- The Faster And Smoother
		game.Workspace.CurrentCamera.FieldOfView =    game.Workspace.CurrentCamera.FieldOfView - 0.5
end

1 comment

1

wait() will not run faster than 1/30 no matter how small a number you give. Simply, some things look fine at a slower speed.

1 answer

RunService.RenderStepped( double step )

Fires every render frame, which is approximately 1/60th of a second. step is the amount of time that elapsed between the last render step and this render step.

RunService.Heartbeat( double step )

Fires every frame. The step argument indicates how much time has passed between frames. This is usually around 1/60th of a second. Please note that this will vary depending on the performance of the machine. If the game is only running at 40 FPS, that means that Heartbeat will fire 40 times per second, and the step argument will be roughly 1/40th of a second.

RunService.Stepped( double time, double step )

Fired on every "step" in the RunService, a time of approximately 1/60th of a second.

You can bind wait to one of these events to make the script yield until the event has passed like so:

game:GetService("RunService").RenderStepped:wait()

or

game:GetService("RunService").Heartbeat:Wait()

(Wait's first letter can be uppercase if you want)

2 comments

1

Also note that you should only use RenderStepped for stuff that deals directly with the camera, since actual rendering doesn't happen until after all code in that is complete.

0

Nice copy and paste. Also, you do not 'bind' anything. You simply call the 'wait' method of the event.

This discussion is preserved as it was. New answers, comments, and votes are closed.