Reproduction Steps:
We need to call an erroring function that’s in a different script from the source, we’ll do it like so:
- Create a
ModuleScript
and parent it toServerScriptService
that has the following source code:
return function(level)
error("Error", level)
end
- Create a
Script
and parent it toServerScriptService
that has the following source code:
require(script.Parent.ModuleScript)(1)
- Press
Run
and look at the output
Behavior and expectations:
- When the error level is
1
aka the default, the output logs the following:
18:55:30.734 ServerScriptService.ModuleScript:2: Error - Server - ModuleScript:2
18:55:30.734 Stack Begin - Studio
18:55:30.734 Script 'ServerScriptService.ModuleScript', Line 2 - Studio - ModuleScript:2
18:55:30.735 Script 'ServerScriptService.Script', Line 1 - Studio - Script:1
18:55:30.735 Stack End - Studio
which tells us the error originates from ServerScriptService.ModuleScript
and when you press the red text in the Output window it opens that ModuleScript as expected:
- When the error level is
2
the output logs the following:
19:00:04.751 ServerScriptService.Script:1: Error - Server - ModuleScript:2
19:00:04.751 Stack Begin - Studio
19:00:04.751 Script 'ServerScriptService.ModuleScript', Line 2 - Studio - ModuleScript:2
19:00:04.751 Script 'ServerScriptService.Script', Line 1 - Studio - Script:1
19:00:04.751 Stack End - Studio
which now tells us the error originates from ServerScriptService.Script
instead of ModuleScript
as expected, but when you press the red text in the Output window it opens that ModuleScript
instead of the Script
:
Pressing the error in the output window seems to always redirect you to the beginning of the stack trace instead of the error level.
Here’s the place file for faster bug replication:
error level.rbxl (54.3 KB)