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

How to get the output of scripts?

Asked by 6 years ago
Edited 6 years ago

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)
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. Impacthills 223 — 6y
0
I want it to show the output of all the scripts you've executed. SebbyTheGODKid 198 — 6y
0
Have you tried adding print(msg) or print(message) ? hellmatic 1523 — 6y
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. Impacthills 223 — 6y
0
But if they executed "print('i want to see my code')" they wouldn't see it. That's the whole question! SebbyTheGODKid 198 — 6y

Answer this question