ScriptContext.Error not working

Reproduction Steps

Run the sample for ScriptContext.Error:

local ScriptContext = game:GetService("ScriptService")

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("Oh noes")

Expected Behavior

It should work

Actual Behavior

I get:

Error is not a valid member of ScriptService “Instance”
Stack Begin
Script ‘ServerScriptService.Script’, Line 9
Stack End

Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly

This is a documentation issue, as you correctly identified here, but it is not an engine bug. In order to make your code work, replace ScriptService with ScriptContext. We are already in the process of fixing the documentation.

2 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.