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

View a client's Print() and warn() functions?

Asked by
Donut792 216 Moderation Voter
5 years ago

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

1 answer

Log in to vote
1
Answered by 5 years ago

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 printed
  • messageType is an enum. It can either be MessageInfo, MessageOutput, MessageError, or MessageWarning.
0
Thanks! Donut792 216 — 5y
0
all i really need this for is catching exploiters so i dont need the script path Donut792 216 — 5y
Ad

Answer this question