Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i detect an exception in roblox?

Asked by 6 years ago
Edited 6 years ago

I need a function to run each time i receive a "image failed to load : request failed" exception. Usually on other scripting languages i would use try-catch. Is there something similar on roblox? i couldn't find any answer online.

1
Lua does not have exceptions. But you can use pcall to check if a function executes correctly. User#5423 17 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
game:GetService("ScriptContext").Error:Connect(function(msg,stack,source)
    print(msg,stack,source.Name)
end)

Catches every error.

0
Does it only catch errors in the script you put the code in? User#20467 0 — 4y
Ad

Answer this question