Is there a version of warn() that sends the error message to something that I can access later?

Basically i’m looking for a function that can be called whenever something terribly goes wrong in some instance of a game. Instead of warn() to the server output, I’d like the warning to go to something I can view in studio or maybe a third party program if that functionality doesn’t exist in studio.

Does something like this exist already? If not, how could i go about implementing it?

You can make a script in the game that receives any warnings and errors with LogService. The MessageOut function can be used for this. An idea I have is to send it to a discord webhook.

game:GetService("LogService").MessageOut:Connect(function(Message, Type)
    if Type == Enum.MessageType.MessageWarning then
         -- send to a discord webhook
    end
end)
11 Likes

Didn’t know about LogService! I’ll go find a tutorial on discord webhooks and try and implement this. Thanks.

No no, please do not use Discord as an error logging service. There’s been many debates about this on the DevForum but at the heart of the matter, you are not supposed to use Discord to log errors. Use a dedicated error tracker like Sentry. Sentry does not come with Lua support out-of-the-box but we have a nice resource that shows you how to set that up.

10 Likes