Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i detect an exception in roblox?

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 comment

1

Lua does not have exceptions. But you can use pcall to check if a function executes correctly.

1 answer

game:GetService("ScriptContext").Error:Connect(function(msg,stack,source)
	print(msg,stack,source.Name)
end)

Catches every error.

1 comment

0

Does it only catch errors in the script you put the code in?

This discussion is preserved as it was. New answers, comments, and votes are closed.