Okay so I'm trying to make something that gets the arguments used in a print function, and stores them. For example, if a user inputs: "print(2+2)", the client sends that code to the server for the server to use loadstring() on, and then returns that print result to the client (since loadstring() can't be used in a local script). Is this possible? If so, how? Here's a visual on how I'd picture doing this:
Server script
-- *some stuff that happens in the server script*
Local script
-- The rest of this would be in a local script
-- This is the code that will be ran on the client
local Code = [[
print("2+2="..tostring(2+2))
]]
local Remote = game:GetService("ReplicatedStorage").Event
-- the server will return the arguments from the print function (again, i'm using a server connection because i think "loadstring" will be involved somehow, and that can't be done locally)
local function GetPrintArgs(fromCode)
local args = Remote:InvokeServer(fromCode)
return args -- maybe returns a table of all the print arguments?
end
print("From client: "..(unpack(GetPrintArgs(Code)))) -- prints the arguments from the "Code" string.
So basically, passing a string of code for the server to use loadstring() on, and then returning a table to the client of every argument used in a print function from that code string. Can this be done? Thank you for your time.

1 comment
YES, THANK YOU!