alright so i got this script here that will print off a when a client errors on the server side but i was wondering if i could do the same thing for print() and warn()?
LocalScript:
local errorEvent = game:GetService("ReplicatedStorage"):WaitForChild("errorEvent") game:GetService("ScriptContext").Error:Connect(function(message, trace, errorScript) local screwup = errorScript:GetFullName() errorEvent:FireServer(message, trace, screwup) end)
Script:
game.ReplicatedStorage.errorEvent.OnServerEvent:Connect(function(player, message, trace, screwup) warn(player.Name.." had an error") print(screwup .. " errored!") print("Reason: "..message) print("Trace: "..trace) warn("--------------error report over--------------") end)
and before i get dumb questions, yes this does work and it works fine as intended without error
You can use the LogService.MessageOut
event to listen for when warn and print are called. Unfortunately you can't get the script from where it printed. But you can get the message type and the message.
Here is some sample code:
local LogService = game:GetService("LogService") LogService.MessageOut:Connect(function(message, messageType) print(message, messageType.Name) end)
message
is the message that was printedmessageType
is an enum. It can either be MessageInfo
, MessageOutput
, MessageError
, or MessageWarning
.