Is it possible to put a loadstring itself in a stringvalue?

What I Tried to achieve?

I wanted to make code that you can type in and run it. But I needed to put the output to a string. And I cannot use the required loadstring()() To work it out.

Loadstring

First of all. loadstring([string])() simply puts string code and makes it into a function in Lua. But you can't simply run it in LocalScript or without LoadstringEnabled Property Set to False. Secondly putting a tostring(loadstring([string])) could be far to easy. But instead it only sends the function name like Function: [Numbers & Letters] Also Enabling Loadstring can allow players to send code to the servers and potentially break the game. (Maybe)

My Code

First of all. My code is a plugin. It can run loadstring() without any exceptions happening to the plugin. Secondly. My Widget Plugin Script is long. So I only show the code to focus on.
-- Variables
local Background = CodePlugin.WidgetBackground
local Code = Background.Code
local CodeOutput = Code.Outputs
local CodeScript = Code.Script

-- Buttons
loadstring(CodeScript.Code.Source.Text)() -- To test if it prints in the output.

CodeOutput.Title.Run.MouseButton1Click:Connect(function()
	CodeOutput.Console.Text = CodeOutput.Console.Text.."\n[RUNNING SIMULATION]\n"..tostring(loadstring(CodeScript.Code.Source.Text)).."\n[SIMULATION FINISHED]"
end)

This code will instead only send the function but not the function that should be outputted.


Any help is appreciated!

Can’t you just use the CodeBox’s text? Or am I missing something?

I did but using the loadstring would not work. It intends to instead find a string. tostring will disable the function that should be running.