24 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

RunService

Inherits from: Instance → Object

RunService contains methods and events for time management as well as for managing the context in which an experience or script is running. Methods like IsClient(), IsServer(), and IsStudio() can help you determine under what context code is running. These methods are useful for ModuleScripts that may be required by both client and server scripts. Furthermore, IsStudio() can be used to add special behaviors for in‑Studio testing.

RunService also houses events that allow your code to adhere to the engine's frame‑by‑frame loop, such as PreRender, PreAnimation, PreSimulation, PostSimulation, and Heartbeat. Selecting the proper event to use for any case is important, so you should read Task Scheduler to make an informed decision.

Context Test Results
Environment Class.RunService:IsStudio()|IsStudio Class.RunService:IsClient()|IsClient Class.RunService:IsServer()|IsServer Class.RunService:IsEdit()|IsEdit Class.RunService:IsRunning()|IsRunning Class.RunService:IsRunMode()|IsRunMode
Live (Client) false true false true false
Live (Server) false false true true false
Edit true true true true false false
Collaborative Edit true true false true false false
Run Mode true false true true true
Play Mode (Client) true true false true false
Play Mode (Server) true false true true false
Team Test (Client) true true false true false
Team Test (Server) true false true true false
Luau Execution false false true false false

Inherits from: Instance

Memory category: Instances

Tags: NotCreatable, Service, NotReplicated

Properties

NameType / ReturnsDescription
RunService.RunStateRunStateThe current run state of the game's simulation.

Inherited from Instance

NameType / ReturnsDescription
Instance.ArchivablebooleanDetermines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published.
Instance.archivableboolean
Instance.CapabilitiesSecurityCapabilitiesThe set of capabilities allowed to be used for scripts inside this container.
Instance.IsInSandboxbooleanIndicates whether the instance is inside a sandboxed container.
Instance.NamestringA non-unique identifier of the Instance.
Instance.ParentInstanceDetermines the hierarchical parent of the Instance.
Instance.PredictionModePredictionModeReflects the client-side prediction mode applied to the instance under server-authoritative physics.
Instance.RobloxLockedbooleanA deprecated property that used to protect CoreGui objects.
Instance.SandboxedbooleanWhen enabled, the instance can only access abilities in its Capabilities list.
Instance.UniqueIdUniqueIdA unique identifier for the instance.

Inherited from Object

NameType / ReturnsDescription
Object.ClassNamestringA read-only string representing the class this Object belongs to.
Object.classNamestring

RunService.RunState

An RunState value that reflects whether the game's simulation is stopped, running, or paused. Reading reports the current state; setting it transitions the simulation, equivalent to RunService:Run(), RunService:Pause(), and RunService:Stop() for the corresponding states. Defaults to RunState.Stopped. Setting this property requires Plugin security.

The state reported here backs the context methods on RunService: it is Running when IsRunning() returns true, and Stopped when IsEdit() returns true.

FieldValue
typeRunState
tags["NotReplicated"]
security{"read":"PluginSecurity","write":"PluginSecurity"}
thread safetyReadSafe
categoryData
serialization{"can_load":false,"can_save":false}
capabilities["Basic"]

Methods

NameType / ReturnsDescription
RunService:BindToAnimationRBXScriptConnectionBinds a custom function to be called at a fixed frequency before Animators update when fixed simulation is enabled, or immediately before BindToSimulation callbacks otherwise.
RunService:BindToRenderStep()Given a string name of a function and a priority, this method binds the function to RunService.PreRender.
RunService:BindToSimulationRBXScriptConnectionBinds a custom function to be called at a fixed frequency which is independent of the frame rate.
RunService:GetPredictionStatusPredictionStatusChecks the PredictionStatus of a specific context instance, useful for debugging scripts affecting multiple instances where some might be predicted and others might not.
RunService:IsClientbooleanReturns whether the current environment is running on the client.
RunService:IsEditbooleanReturns whether the current environment is in Edit mode.
RunService:IsResimulatingbooleanReturns whether the client is currently in a resimulation step after a misprediction in the server authority model.
RunService:IsRunModebooleanReturns whether a Run playtest has been initiated in Studio.
RunService:IsRunningbooleanReturns whether the experience is currently running.
RunService:IsServerbooleanReturns whether the current environment is running on the server.
RunService:IsStudiobooleanReturns whether the current environment is running in Studio.
RunService:Pause()Pauses the experience's simulation if it is running, suspending physics and scripts.
RunService:Reset()Resets the current game to a waypoint set when RunService:Run() was called.
RunService:Run()Runs the game's simulation, running physics and scripts.
RunService:SetPredictionMode()Sets the prediction mode for an Instance to an PredictionMode value.
RunService:Stop()Stops the experience's simulation if it is running.
RunService:UnbindFromRenderStep()Unbinds a function that was bound to the render loop using RunService:BindToRenderStep().

Inherited from Instance

NameType / ReturnsDescription
Instance:AddTag()Applies a tag to the instance.
Instance:childrenInstancesReturns an array of the object's children.
Instance:ClearAllChildren()This method destroys all of an instance's children.
Instance:CloneInstanceCreate a copy of an instance and all its descendants, ignoring instances that are not Archivable.
Instance:cloneInstance
Instance:Destroy()Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children.
Instance:destroy()
Instance:FindFirstAncestorInstance?Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
Instance:FindFirstAncestorOfClassInstance?Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className.
Instance:FindFirstAncestorWhichIsAInstance?Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className.
Instance:FindFirstChildInstance?Returns the first child of the Instance found with the given name.
Instance:findFirstChildInstance
Instance:FindFirstChildOfClassInstance?Returns the first child of the Instance whose ClassName is equal to the given class name.
Instance:FindFirstChildWhichIsAInstance?Returns the first child of the Instance for whom Object:IsA() returns true for the given className.
Instance:FindFirstDescendantInstance?Returns the first descendant found with the given Instance.Name.
Instance:GetActorActor?Returns the Actor associated with the Instance, if any.
Instance:GetAttributeVariantReturns the value which has been assigned to the given attribute name.
Instance:GetAttributeChangedSignalRBXScriptSignalReturns an event that fires when the given attribute changes.
Instance:GetAttributesDictionaryReturns a dictionary of the instance's attributes.
Instance:GetChildrenInstancesReturns an array containing all of the instance's children.
Instance:getChildrenInstances
Instance:GetDebugIdstringReturns a coded string of the debug ID used internally by Roblox.
Instance:GetDescendantsInstancesReturns an array containing all of the descendants of the instance.
Instance:GetFullNamestringReturns a string describing the instance's ancestry.
Instance:GetStyledVariantReturns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified.
Instance:GetStyledPropertyChangedSignalRBXScriptSignalReturns an event that fires when the given style property changes on the instance.
Instance:GetTagsArrayGets an array of all tags applied to the instance.
Instance:HasTagbooleanCheck whether the instance has a given tag.
Instance:IsAncestorOfbooleanReturns true if an Instance is an ancestor of the given descendant.
Instance:IsDescendantOfbooleanReturns true if an Instance is a descendant of the given ancestor.
Instance:isDescendantOfboolean
Instance:IsPropertyModifiedbooleanReturns true if the value stored in the specified property is not equal to the code-instantiated default.
Instance:QueryDescendantsInstancesReturns an array containing all descendants of the instance that match the selector string.
Instance:Remove()Sets the object's Parent to nil, and does the same for all its descendants.
Instance:remove()
Instance:RemoveTag()Removes a tag from the instance.
Instance:ResetPropertyToDefault()Resets a property to its default value.
Instance:SetAttribute()Sets the attribute with the given name to the given value.
Instance:WaitForChildInstanceReturns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does.

Inherited from Object

NameType / ReturnsDescription
Object:GetPropertyChangedSignalRBXScriptSignalGet an event that fires when a given property of the object changes.
Object:IsAbooleanReturns true if an object's class matches or inherits from a given class.
Object:isAboolean

RunService:BindToAnimation

BindToAnimation() binds a custom function to be called at a fixed frequency which is independent of the frame rate. When Workspace.UseFixedSimulation is enabled, these functions are invoked before Animators update, making this the fixed-frequency counterpart to PreAnimation. When fixed simulation is disabled, they instead run immediately before BindToSimulation() callbacks, so no pre-animation ordering should be assumed. In the server authority model, bound functions will also get called when the client needs to resimulate.

Like BindToSimulation(), the bound function is meant for physics controllers and prediction, so an error will trigger if you read or write from unsynchronized properties or call an unsynchronized method. This error is meant to help guide you in writing a pure, synchronized simulation.

To synchronize inaccessible properties, you should store the relevant data in attributes and update the relevant property in PostSimulation or RenderStepped by reading from attributes. This will leverage attribute synchronization to keep the property fully synchronized through the rollback mechanism.

Parameters

NameTypeDefaultDescription
functionFunctionThe function to call. This function will be passed one parameter called deltaTime, which shows the elapsed time since the callback's previous invocation.
frequencyStepFrequencyHz30Optional StepFrequency value indicating the frequency at which to call the bound function. Defaults to StepFrequency.Hz30.
priorityint2000Optional priority of the binding as an integer; it determines the order in which bound functions are called within a simulation step. Lower numbers are called first. If two bindings have the same priority, the order between them is unspecified. Defaults to 2000.

Returns

TypeDescription
RBXScriptConnectionA RBXScriptConnection that can be disconnected to unregister the callback.
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]

RunService:BindToRenderStep

The BindToRenderStep() function binds a custom function to be called at a specific time during the render step. There are three main arguments: name, priority, and what function to call.

As it is linked to the client's rendering process, BindToRenderStep() can only be called on the client.

Name

The name parameter is a label for the binding and can be used with RunService:UnbindFromRenderStep() if the binding is no longer needed.

local RunService = game:GetService("RunService")

local function functionToBind() end

-- Bind the function above to the binding named "tempBinding"
RunService:BindToRenderStep("tempBinding", 1, functionToBind)
-- Unbind the function bound to "tempBinding"
RunService:UnbindFromRenderStep("tempBinding")
Priority

The priority of the binding is an integer; it determines when during the render step to call the custom function. The lower this number, the sooner the custom function will be called. If two bindings have the same priority, the engine will randomly pick one to run first. The default control scripts run with these specific priorities:

When using RenderPriority, remember to use .Value at the end of the desired enum. RunService:BindToRenderStep() will not work if just the enum is used on its own.

local RunService = game:GetService("RunService")

local function beforeCamera(delta)
	-- Code in here will run before the default camera script
end

RunService:BindToRenderStep("Before camera", Enum.RenderPriority.Camera.Value - 1, beforeCamera)
Custom Function and Delta Time

The last argument (function) is the custom function to call. This function will be passed one parameter called deltaTime which shows how much time passed between the beginning of the previous render step and the beginning of the current render step.

All rendering updates will wait until the code in the render step finishes. Make sure that any code called by BindToRenderStep() runs quickly and efficiently; if code takes too long, the experience visuals will be choppy.

Parameters

NameTypeDefaultDescription
namestringLabel for the binding which can be used with Unbind if the binding is no longer needed.
priorityintPriority of the binding as an integer; it determines when during the render step to call the custom function. The lower this number, the sooner the custom function will be called. If two bindings have the same priority, the engine will randomly pick one to run first.
functionFunctionThe custom function being bound.

Returns

TypeDescription
()
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]

Code samples: View on Creator Hub (RunService-BindToRenderStep, runservice-custom-function, runservice-unbindfromrenderstep).

RunService:BindToSimulation

BindToSimulation() binds a custom function to be called at a fixed frequency which is independent of the frame rate. In the server authority model, bound functions will also get called when the client needs to resimulate. This method is only available when Workspace.UseFixedSimulation is enabled.

Note that since the bound function is meant for physics controllers and prediction, an error will trigger if you read or write from unsynchronized properties or call an unsynchronized method. This error is meant to help guide you in writing a pure, synchronized simulation.

To synchronize inaccessible properties, you should store the relevant data in attributes and update the relevant property in PostSimulation or RenderStepped by reading from attributes. This will leverage attribute synchronization to keep the property fully synchronized through the rollback mechanism.

Parameters

NameTypeDefaultDescription
functionFunctionThe function to call. This function will be passed one parameter called deltaTime which shows how much time passed between the beginning of the previous simulation step and the beginning of the current simulation step.
frequencyStepFrequencyHz30Optional StepFrequency value indicating the frequency at which to call the bound function. If not provided, the default frequency will be used.
priorityint2000Optional priority of the binding as an integer; it determines the order in which bound functions are called within a simulation step. Lower numbers are called first. If two bindings have the same priority, the order between them is unspecified. Defaults to 2000.

Returns

TypeDescription
RBXScriptConnectionAn RBXScriptConnection that can be disconnected to unbind the function from the simulation step.
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]

Code samples: View on Creator Hub (RunService-BindToSimulation).

RunService:GetPredictionStatus

Clients can use this method to check the PredictionStatus of a specific context instance, useful for debugging scripts affecting multiple instances (vehicle controllers, custom physics, etc.) where some might be predicted and others might not. This method is also useful for debugging and observing the effects of PredictionMode.Automatic prediction mode.

Parameters

NameTypeDefaultDescription
contextInstanceThe Instance for which to check prediction status.

Returns

TypeDescription
PredictionStatusThe PredictionStatus of the given instance, indicating whether it is predicted, authoritative, or not participating in prediction.
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]
simulationAccesstrue

RunService:IsClient

If the code that invoked this method is running in a client context (in a LocalScript, in a ModuleScript required by a LocalScript, or in a Script with RunContext set to RunContext.Client), this method will return true. In all other cases, this method will return false.

If this method returns true, the current environment can access client‑only features like RunService.PreRender or Players.LocalPlayer.

Returns

TypeDescription
booleanWhether the current environment is running the client.
FieldValue
securityNone
thread safetySafe
capabilities["Basic"]

RunService:IsEdit

This method returns whether the current environment is in "edit" mode, for example in Studio when the experience is not running.

IsEdit() will return the inverse of IsRunning(), except when the simulation has been paused, in which case both methods will return false.

Returns

TypeDescription
booleanWhether the current environment is in "edit" mode.
FieldValue
securityPluginSecurity
thread safetySafe
capabilities["Basic"]

RunService:IsResimulating

Returns true if the engine is currently replaying simulation steps after detecting a misprediction in the server authority model; returns false otherwise. When the server's authoritative state diverges from the client's predicted state, the client rolls back and rapidly resimulates all affected steps within a single frame. During that resimulation pass, BindToSimulation() callbacks and property-changed signals fire again for each replayed step, which can cause unwanted side effects such as duplicate sound playback or redundant network requests.

Returns

TypeDescription
booleanWhether the engine is currently resimulating.
FieldValue
securityNone
thread safetySafe
capabilities["Basic"]
simulationAccesstrue

RunService:IsRunMode

This method returns whether a Run playtest has been initiated in Studio. It will continue to return true if the simulation has been paused using the Pause button; however, once it has been stopped using the Stop button, it will revert to returning false. Note that Studio only enters "run" mode when a Run playtest (without the user's player character) is initiated. Also note that this method will return false if the simulation was started using RunService:Run().

Returns

TypeDescription
booleanWhether a Run playtest has been initiated in Studio.
FieldValue
securityNone
thread safetySafe
capabilities["Basic"]

RunService:IsRunning

Returns whether the experience is currently running. IsRunning() will always return the inverse of IsEdit() except when the simulation has been paused, in which case both methods will return false.

Returns

TypeDescription
booleanWhether the experience is currently running.
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]

RunService:IsServer

This method returns whether the current environment is running on the server. If the code that invoked this method is running in a server context (in a Script with RunContext set to RunContext.Server or RunContext.Legacy, or in a ModuleScript required by a Script), this method will return true. In all other cases, this method will return false.

If this function returns true, then the current environment can access server‑only features like ServerStorage or ServerScriptService.

Returns

TypeDescription
booleanWhether the current environment is running on the server.
FieldValue
securityNone
thread safetySafe
capabilities["Basic"]

RunService:IsStudio

This method returns whether the current environment is running in Studio. It can be used to wrap code that should only execute when testing in Studio.

Returns

TypeDescription
booleanWhether the current environment is running in Studio.
FieldValue
securityNone
thread safetySafe
capabilities["Basic"]

RunService:Pause

This method pauses the experience's simulation if it is running, suspending physics and scripts. When the simulation is paused, IsRunning() will return false.

Returns

TypeDescription
()
FieldValue
securityPluginSecurity
thread safetyUnsafe
capabilities["Basic"]

RunService:Reset

Deprecated. This item is deprecated and should not be used in new work.

The Reset function resets the current game to a waypoint set when Run was called. This method should only be used after Run was called.

Returns

TypeDescription
()
FieldValue
tags["Deprecated"]
securityPluginSecurity
thread safetyUnsafe
capabilities["Basic"]

RunService:Run

This method runs the experience's simulation (physics and scripts). When the simulation is running, IsRunning() will return true. However, IsRunMode() will only return true if the simulation was started using the Run button in Studio.

Returns

TypeDescription
()
FieldValue
securityPluginSecurity
thread safetyUnsafe
capabilities["Basic"]

RunService:SetPredictionMode

Sets the prediction mode for an Instance (context) to an PredictionMode value. Mismatches between the physics properties or attributes for predicted instances will cause a rollback and resimulation on the client. Can only be called on the client.

Parameters

NameTypeDefaultDescription
contextInstanceThe Instance for which to set the prediction mode.
modePredictionModeThe PredictionMode to set for the context instance.

Returns

TypeDescription
()
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]

RunService:Stop

This method stops the experience's simulation if it is running. When the simulation is stopped, IsRunning() will return false and IsEdit() will return true.

In contrast to the Stop button in Studio, calling this method will not restore the experience to the state it was in prior to the simulation being run. This means any changes made to the experience by the physics simulation and scripts will persist after the simulation has ended.

Returns

TypeDescription
()
FieldValue
securityPluginSecurity
thread safetyUnsafe
capabilities["Basic"]

RunService:UnbindFromRenderStep

Given a name of a function sent to BindToRenderStep(), this method will unbind the function from being called during PreRender. This is used to unbind bound functions once they are no longer needed, or when they no longer need to fire every step.

If there is no bound function by the given name, this method takes no action and continues without raising an error.

Parameters

NameTypeDefaultDescription
namestringThe name of the function being unbound.

Returns

TypeDescription
()
FieldValue
securityNone
thread safetyUnsafe
capabilities["Basic"]

Events

NameType / ReturnsDescription
RunService.HeartbeatFires every frame, after the physics simulation has completed.
RunService.MispredictionIn the server authority model, fires during prediction when the engine detects that the client has diverged from the server's authoritative state. Intended for plugin-based debugging.
RunService.PostSimulationFires every frame, after the physics simulation has completed.
RunService.PreAnimationFires every frame, prior to the physics simulation but after rendering.
RunService.PreRenderFires every frame, prior to the frame being rendered.
RunService.PreSimulationFires every frame, prior to the physics simulation.
RunService.RenderSteppedFires every frame, prior to the frame being rendered.
RunService.RollbackIn the server authority model, this fires after rolling back the predicted state due to a misprediction, but before resimulation begins.
RunService.SteppedFires every frame, prior to the physics simulation.

Inherited from Instance

NameType / ReturnsDescription
Instance.AncestryChangedFires when the Instance.Parent property of this object or one of its ancestors is changed.
Instance.AttributeChangedFires whenever an attribute is changed on the Instance.
Instance.ChildAddedFires after an object is parented to this Instance.
Instance.childAdded
Instance.ChildRemovedFires after a child is removed from this Instance.
Instance.DescendantAddedFires after a descendant is added to the Instance.
Instance.DescendantRemovingFires immediately before a descendant of the Instance is removed.
Instance.DestroyingFires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy().
Instance.StyledPropertiesChangedFires whenever any style property is changed on the instance, including when a property is set to nil.

Inherited from Object

NameType / ReturnsDescription
Object.ChangedFires immediately after a property of the object changes, with some limitations.

RunService.Heartbeat

The Heartbeat event fires every frame, after the physics simulation has completed. The deltaTime argument indicates the time that has elapsed since the previous frame.

This event is when most scripts run. It occurs at the end of each frame and it's also when any waiting scripts are executed, such as those scheduled with the task library. Heartbeat is commonly used for periodic tasks, such as updating core game systems like health regeneration.

Following this step, the engine sends property updates and events to the server or clients which are later received as part of the replication receive step.

Parameters

NameTypeDefaultDescription
deltaTimedoubleThe time (in seconds) that has elapsed since the previous frame.
FieldValue
securityNone
capabilities["Basic"]

RunService.Misprediction

With server authority enabled, the Misprediction event fires when a received server state differs from the predicted state.

Use this event to build debugging tools that inspect misprediction data programmatically. For example, a plugin could listen for this event and track which instances are frequently mispredicting, what properties are diverging, and by how much.

Instances Array

Each entry in the instances array is a table with the following structure:

Field Type Description
Instance Instance The instance that was mispredicted.
Properties dictionary? Properties that were mispredicted. Each key is a property name mapping to a table with the client's Predicted and owner's/server's Authoritative values as captured on the step when the client first mispredicted the owner's value. Only present if there are property mismatches.
Attributes dictionary? Attributes that were mispredicted. Each key is a property name mapping to a table with the client's Predicted and owner's/server's Authoritative values as captured on the step when the client first mispredicted the owner's value. Only present if there are attribute mismatches.
Stats Dictionary

The stats dictionary contains the following fields:

Field Type Description
ResimulationTime number The time spent during resimulation (or the amount of time rolled back).
Code Sample

Parameters

NameTypeDefaultDescription
timedoubleThe time (in seconds) from the start of simulation at which the client's predicted state first diverged from the server's authoritative state.
instancesArrayAn array of tables, each describing an Instance that was mispredicted. See below for the structure of each entry.
statsDictionaryA dictionary of statistics about the misprediction. See below for the structure.
FieldValue
securityNone
capabilities["Basic","PluginOrOpenCloud"]

Code samples: View on Creator Hub (RunService-Misprediction).

RunService.PostSimulation

The PostSimulation event fires every frame, after the physics simulation has completed. The deltaTimeSim argument indicates the time that the current frame has stepped the physics simulation, not accounting for physics throttling. This may deviate from the actual time between frames in Studio edit mode or when framerate is very low.

This event is useful for making final adjustments to the outcome of the simulation. Following this phase, the engine triggers the Heartbeat event.

Parameters

NameTypeDefaultDescription
deltaTimeSimdoubleThe time (in seconds) that the current frame has stepped the physics simulation, not accounting for physics throttling.
FieldValue
securityNone
capabilities["Basic"]

RunService.PreAnimation

The PreAnimation event fires every frame, prior to the physics simulation but after rendering. The deltaTimeSim argument indicates the time that the current frame has stepped animations.

This event is useful for modifying animation objects, such as adjusting their speed or priority. Once the PreAnimation event is complete, the engine proceeds to run these animations, updating the joint transforms which will later be used to update objects during the physics simulation.

After animations are stepped, the engine triggers the PreSimulation event.

Parameters

NameTypeDefaultDescription
deltaTimeSimdoubleThe time (in seconds) that the current frame has stepped animations.
FieldValue
securityNone
capabilities["Basic"]

RunService.PreRender

The PreRender event (replacement for RenderStepped) fires every frame, prior to the frame being rendered. The deltaTimeRender argument indicates the time that has elapsed since the previous frame.

This event allows you to run code and update the world before it's drawn on a player's screen. This is useful for last‑minute adjustments such as changing object positions, updating animations, or preparing visual effects, but it should be used sparingly as the engine cannot start to render the frame until code running in this event has finished executing.

As PreRender is client-side, it can only be used in a LocalScript, in a ModuleScript required by a LocalScript, or in a Script with RunContext set to RunContext.Client.

Parameters

NameTypeDefaultDescription
deltaTimeRenderdoubleThe time (in seconds) that has elapsed since the previous frame.
FieldValue
securityNone
capabilities["Basic"]

RunService.PreSimulation

The PreSimulation event (replacement for Stepped) fires every frame, prior to the physics simulation. The deltaTimeSim argument indicates the time that the current frame will step the physics simulation, not accounting for physics throttling. This may deviate from the actual time between frames in Studio edit mode or when framerate is very low.

This event is useful for adjusting properties like velocity or forces just before they're applied as part of the simulation. The simulation then runs, potentially multiple times, as the physics solver runs at a higher frequency than other engine systems. Once this is complete, the PostSimulation event is fired.

Parameters

NameTypeDefaultDescription
deltaTimeSimdoubleThe time (in seconds) that the current frame will step the physics simulation, not accounting for physics throttling.
FieldValue
securityNone
capabilities["Basic"]

RunService.RenderStepped

Fires every frame, prior to the frame being rendered.

Migration Note

This event has been superseded by PreRender which should be used for new work.

Parameters

NameTypeDefaultDescription
deltaTimedoubleThe time (in seconds) that has elapsed since the previous frame.
FieldValue
securityNone
capabilities["Basic"]

RunService.Rollback

When server authority is enabled, the Rollback event fires after the engine detects a misprediction and rolls back all eligible state (properties, attributes, and related physics and animation state), but before the engine resimulates the rolled-back steps.

Use this event to update state in your place that wouldn't otherwise be rolled back after a misprediction. For example, if you maintain gameplay state that can't be stored in a property or attribute with simulation access, you can listen for this event, compare the rolled-back-to step against your farthest-reached step, and rewind your custom state accordingly.

Parameters

NameTypeDefaultDescription
timedoubleThe time (in seconds) that we are rolling back to.
FieldValue
securityNone
capabilities["Basic"]

Code samples: View on Creator Hub (RunService-Rollback).

RunService.Stepped

Fires every frame, prior to the physics simulation.

Migration Note

This event has been superseded by PreSimulation which should be used for new work.

Parameters

NameTypeDefaultDescription
timedoubleThe duration (in seconds) that RunService has been running for.
deltaTimedoubleThe time (in seconds) that has elapsed since the previous frame.
FieldValue
securityNone
capabilities["Basic"]