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

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

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

✓ Accepted answer

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.

2 comments

0

Thanks!

0

all i really need this for is catching exploiters so i dont need the script path

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