Actually you can create a script using this, from a string:
All you need is a disabled script with a string value called “Script” in it. You set the value in another script and clone it.
-- ScriptBase
local Loadstring = require(...) -- replace with the path to the module
Loadstring(script.Script.Value)()
-- MainScript
local ScriptBase = script.ScriptBase
function loadString(string, parent)
local ScriptBase = ScriptBase:Clone()
ScriptBase.Script.Value = string
ScriptBase.Disabled = false
ScriptBase.Parent = parent -- whatever parent
end
loadString("print('Hello World!')", workspace)