How can I get the output of scripts, not just errors, but also if print() is being called, the output of that. The code I have right now only checks for errors.

game:GetService("ScriptContext").Error:connect(function(msg,stack,source)
	if source == script then
		msg = string.gsub(msg,"Workspace.loadcode.Compiler","LuaVM")
		msg = string.gsub(msg,"@compiled-lua","@loadstring")
		msg = string.gsub(msg,"compiled-lua","@loadstring")
		local message = msg
		log("bad",message)
		game:GetService("ReplicatedStorage").PostDiscord:InvokeServer(message,"error",false)
	end
end)

5 comments

0

Are you trying to create an event to listen to all the prints in all of your scripts? If not you know you can just use print (msg) to console. Please let me know more about your question.

0

I want it to show the output of all the scripts you've executed.

0

Have you tried adding print(msg) or print(message) ?

0

Maybe you can have a server script to scan through workspace/serverscriptservice/etc and add all scripts by checking if the instance ends with .lua and check that they are not disabled and print to console which scripts have ran. Idk lol. I'd have to think of a better approach. That may take awhile to load but I'm not sure.

0

But if they executed "print('i want to see my code')" they wouldn't see it. That's the whole question!