PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

RenderStepped

The RenderStepped event fires when a frame is rendered on the client. It fires at around 60 times per second, so the time step is around 0.0166 seconds. If the framerate drops, this event fires less often.

There’s no guarantee that functions connected to this event will fire at the exact same time. To be sure that certain functions are called in synchronization with each other, use RunService/BindToRenderStep instead, which allows specification of a “render priority”.

Also note that RenderStepped must only be used in LocalScripts, as they refer to each frame that is being rendered.

Parameters

Name Type Default Description

The time since the last render frame.


Code Samples


Spin GuiObject

This code sample rotates a parent GuiObject (such as a Frame) using a given rotation speed and the RunService/RenderStepped event.

local RunService = game:GetService("RunService")

local guiObject = script.Parent

local degreesPerSecond = 180

local function onRenderStep(deltaTime)
	local deltaRotation = deltaTime * degreesPerSecond
	guiObject.Rotation = guiObject.Rotation + deltaRotation 
end
RunService.RenderStepped:Connect(onRenderStep)