ScriptContext

Show Deprecated
Not Creatable
Service
Not Replicated

This service controls all BaseScript objects. Most of the properties and methods of this service are locked for internal use.

Summary

Methods

  • SetTimeout(seconds : number):void
    Plugin Security

    Limits how long a script is allowed to run without yielding.

Events

Properties

Methods

SetTimeout

void
Plugin Security

Limits how long a script is allowed to run without yielding.

Parameters

seconds: number

Returns

void

Events

Error

Fired when an error occurs.

Parameters

message: string
stackTrace: string
script: Instance

Code Samples

ScriptContext.Error

local ScriptContext = game:GetService("ScriptContext")
local function onError(message, trace, script)
print(script:GetFullName(), "errored!")
print("Reason:", message)
print("Trace:", trace)
end
ScriptContext.Error:Connect(onError)
-- Somewhere, in another script
error("Error occurred!")