Skip to content
Roblox API Reference

RunService

Service responsible for all runtime activity and progression of time.
  • Not creatable
  • Not replicated
  • Service
Memory category
Instances
Own members
44
Inherited members
75
Subclasses
0
Siblings
608

Properties26

Inherited fromObject2

Property categoryData

Inherited fromInstance21

Property categoryBehavior

Property categoryData

Property categoryPermissions

Defined byRunService3

Property categoryData

  • RunService.ClientGitHash: string
    • Read only
    • Roblox script security
    • Read capabilities: Basic
  • RunService.RunState: Enum.RunState
    The current run state of the game's simulation.
    • Not replicated
    • Write: Plugin security
    • Read capabilities: Basic + PluginOrOpenCloud

Property categoryServer Authority

  • RunService.FrameNumber: number
    • Read only
    • Read capabilities: Basic + InternalTest
    • Write capabilities: InternalTest

Methods73

Inherited fromObject3
  • Get an event that fires when a given property of the object changes.
    Parameters
    ParameterDescription
    property: string
    The property to connect to.
    Returns
    TypeDescription
    RBXScriptSignal
    A signal that fires whenever the property changes.
  • Object:IsA(className: string): boolean
    Returns true if an object's class matches or inherits from a given class.
    • Custom Lua state
    • Thread safe
    Parameters
    ParameterDescription
    className: string
    The class against which the Object's class will be checked. Case-sensitive.
    Returns
    TypeDescription
    boolean
    Describes whether the Object's class matched or is a subclass of the given class.
  • Object:isA(className: string): boolean
    Deprecated: This deprecated function is a variant of Object:IsA() which should be used instead.
    • Deprecated
    • Custom Lua state
    Parameters
    Parameter
    className: string
    Returns
    Type
    boolean

    Use IsA instead.

Inherited fromInstance39
Defined byRunService31
  • RunService:BindToAnimation(function: (...any) -> ...any,frequency: Enum.StepFrequency? = Enum.StepFrequency.Hz30,priority: number? = 2000,): RBXScriptConnection
    Binds a custom function to be called at a fixed frequency before Animators update when fixed simulation is enabled, or immediately before BindToSimulation callbacks otherwise.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    function: (...any) -> ...any
    The function to call. This function will be passed one parameter called deltaTime, which shows the elapsed time since the callback's previous invocation.
    frequency: Enum.StepFrequency? = Enum.StepFrequency.Hz30
    Optional StepFrequency value indicating the frequency at which to call the bound function. Defaults to StepFrequency.Hz30.
    priority: number? = 2000
    Optional 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
    RBXScriptConnection
    A RBXScriptConnection that can be disconnected to unregister the callback.
  • RunService:BindToRenderStep(name: string,priority: number,function: (...any) -> ...any,)
    Given a string name of a function and a priority, this method binds the function to RunService.PreRender.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    name: string
    Label for the binding which can be used with Unbind if the binding is no longer needed.
    priority: number
    Priority 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.
    function: (...any) -> ...any
    The custom function being bound.
  • RunService:BindToSimulation(function: (...any) -> ...any,frequency: Enum.StepFrequency? = Enum.StepFrequency.Hz30,priority: number? = 2000,): RBXScriptConnection
    Binds a custom function to be called at a fixed frequency which is independent of the frame rate.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    function: (...any) -> ...any
    The 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.
    frequency: Enum.StepFrequency? = Enum.StepFrequency.Hz30
    Optional StepFrequency value indicating the frequency at which to call the bound function. If not provided, the default frequency will be used.
    priority: number? = 2000
    Optional 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
    RBXScriptConnection
    An RBXScriptConnection that can be disconnected to unbind the function from the simulation step.
  • RunService:GetControlAndVariantRolloutFlags(): ...any
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    ...any
  • RunService:GetCoreScriptVersion(): string
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    string
  • RunService:GetPhysicsStepId(): number
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    number
  • RunService:GetPredictionStatus(context: Instance): Enum.PredictionStatus
    Checks the PredictionStatus of a specific context instance, useful for debugging scripts affecting multiple instances where some might be predicted and others might not.
    • Capabilities: Basic
    • Simulation access
    Parameters
    ParameterDescription
    context: Instance
    The Instance for which to check prediction status.
    Returns
    TypeDescription
    Enum.PredictionStatus
    The PredictionStatus of the given instance, indicating whether it is predicted, authoritative, or not participating in prediction.
  • RunService:GetRobloxClientChannel(): string
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    string
  • RunService:GetRobloxClientIxpEnrolledExperiments(): string
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    string
  • RunService:GetRobloxGuiFocused(): boolean
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    boolean
  • RunService:GetRobloxVersion(): string
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    string
  • RunService:GetTotalScriptPlusExecutionTime(): number
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    number
  • RunService:IsClient(): boolean
    Returns whether the current environment is running on the client.
    • Thread safe
    • Capabilities: Basic
    Returns
    TypeDescription
    boolean
    Whether the current environment is running the client.
  • RunService:IsEdit(): boolean
    Returns whether the current environment is in Edit mode.
    • Thread safe
    • Capabilities: Basic + PluginOrOpenCloud
    Returns
    TypeDescription
    boolean
    Whether the current environment is in "edit" mode.
  • RunService:IsResimulating(): boolean
    Returns whether the client is currently in a resimulation step after a misprediction in the server authority model.
    • Thread safe
    • Capabilities: Basic
    • Simulation access
    Returns
    TypeDescription
    boolean
    Whether the engine is currently resimulating.
  • RunService:IsRunMode(): boolean
    Returns whether a Run playtest has been initiated in Studio.
    • Thread safe
    • Capabilities: Basic
    Returns
    TypeDescription
    boolean
    Whether a Run playtest has been initiated in Studio.
  • RunService:IsRunning(): boolean
    Returns whether the experience is currently running.
    • Capabilities: Basic
    Returns
    TypeDescription
    boolean
    Whether the experience is currently running.
  • RunService:IsServer(): boolean
    Returns whether the current environment is running on the server.
    • Thread safe
    • Capabilities: Basic
    Returns
    TypeDescription
    boolean
    Whether the current environment is running on the server.
  • RunService:IsStudio(): boolean
    Returns whether the current environment is running in Studio.
    • Thread safe
    • Capabilities: Basic
    Returns
    TypeDescription
    boolean
    Whether the current environment is running in Studio.
  • RunService:IsTeamCreateViewer(): boolean
    • Roblox script security
    • Thread safe
    • Capabilities: Basic
    Returns
    Type
    boolean
  • RunService:IsTeamTest(): boolean
    • Roblox script security
    • Thread safe
    • Capabilities: Basic
    Returns
    Type
    boolean
  • RunService:Pause()
    Pauses the experience's simulation if it is running, suspending physics and scripts.
    • Plugin security
    • Capabilities: Basic
  • RunService:Run()
    Runs the game's simulation, running physics and scripts.
    • Plugin security
    • Capabilities: Basic
  • RunService:Set3dRenderingEnabled(enable: boolean)
    • Roblox script security
    • Capabilities: Basic
    Parameters
    Parameter
    enable: boolean
  • RunService:SetPredictionMode(context: Instance, mode: Enum.PredictionMode)
    Sets the prediction mode for an Instance to an PredictionMode value.
    • Capabilities: Basic
    Parameters
    ParameterDescription
    context: Instance
    The Instance for which to set the prediction mode.
    mode: Enum.PredictionMode
    The PredictionMode to set for the context instance.
  • RunService:SetRobloxGuiFocused(focus: boolean)
    • Roblox script security
    • Capabilities: Basic
    Parameters
    Parameter
    focus: boolean
  • RunService:Stop()
    Stops the experience's simulation if it is running.
    • Plugin security
    • Capabilities: Basic
  • RunService:UnbindFromRenderStep(name: string)
    Unbinds a function that was bound to the render loop using RunService:BindToRenderStep().
    • Capabilities: Basic
    Parameters
    ParameterDescription
    name: string
    The name of the function being unbound.
  • RunService:getThrottleFramerateEnabled(): boolean
    • Roblox script security
    • Capabilities: Basic
    Returns
    Type
    boolean
  • RunService:setThrottleFramerateEnabled(enable: boolean)
    • Roblox script security
    • Capabilities: Basic
    Parameters
    Parameter
    enable: boolean
  • RunService:Reset()
    Deprecated: This item is deprecated and should not be used in new work.
    Resets the current game to a waypoint set when RunService:Run() was called.
    • Deprecated
    • Plugin security
    • Capabilities: Basic

Events20

Inherited fromObject1
Inherited fromInstance9
Defined byRunService10
  • RunService.Heartbeat: RBXScriptSignal<(deltaTime: number)>
    Fires every frame, after the physics simulation has completed.
    • Capabilities: Basic
    Parameters
    Parameter
    deltaTime: number
  • RunService.Misprediction: RBXScriptSignal<(time: number,instances: { any },stats: { [string]: any },)>
    In 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.
    • Capabilities: Basic + PluginOrOpenCloud
    Parameters
    Parameter
    time: number
    instances: { any }
    stats: { [string]: any }
  • RunService.PostSimulation: RBXScriptSignal<(deltaTimeSim: number)>
    Fires every frame, after the physics simulation has completed.
    • Capabilities: Basic
    Parameters
    Parameter
    deltaTimeSim: number
  • RunService.PreAnimation: RBXScriptSignal<(deltaTimeSim: number)>
    Fires every frame, prior to the physics simulation but after rendering.
    • Capabilities: Basic
    Parameters
    Parameter
    deltaTimeSim: number
  • RunService.PreRender: RBXScriptSignal<(deltaTimeRender: number)>
    Fires every frame, prior to the frame being rendered.
    • Capabilities: Basic
    Parameters
    Parameter
    deltaTimeRender: number
  • RunService.PreSimulation: RBXScriptSignal<(deltaTimeSim: number)>
    Fires every frame, prior to the physics simulation.
    • Capabilities: Basic
    Parameters
    Parameter
    deltaTimeSim: number
  • RunService.RenderStepped: RBXScriptSignal<(deltaTime: number)>
    Fires every frame, prior to the frame being rendered.
    • Capabilities: Basic
    Parameters
    Parameter
    deltaTime: number
  • RunService.RobloxGuiFocusedChanged: RBXScriptSignal<(isRobloxGuiFocused: boolean)>
    • Roblox script security
    • Capabilities: Basic
    Parameters
    Parameter
    isRobloxGuiFocused: boolean
  • RunService.Rollback: RBXScriptSignal<(time: number)>
    In the server authority model, this fires after rolling back the predicted state due to a misprediction, but before resimulation begins.
    • Capabilities: Basic
    Parameters
    Parameter
    time: number
  • RunService.Stepped: RBXScriptSignal<(time: number, deltaTime: number)>
    Fires every frame, prior to the physics simulation.
    • Capabilities: Basic
    Parameters
    Parameter
    time: number
    deltaTime: number