How would I create that a player can write a script in to a text box and then this it is converted from a script into a new script

The only possible way i could think of, is that a script detects the content of the text box and uses a different pre made function for every script part. Like this:

Players script: print ("Hello!")

Server scripts action:

if string.find(InsertedScript, "print (", 1, -1) ~= nil then
	local Position1 = string.find(InsertedScript, "print (", 1,-1
	local Position2 = string.find(InsertedScript, ")", 1,-1
	local Text = string.sub(InsertedScript, Position1 + 1, Position2 - 1)
	print (Text)
end

Apart from the fact that the script would not even work that way, it would not be a good solution, so I would like to know if there is a simpler / better way

4 comments

0

you cant directly insert code into a script from another script, at least not in a way it can run. You can try making a code update a module script, which can be required by local / server scripts https://developer.roblox.com/api-reference/class/ModuleScript

0

how would you update a module script?

0

can i ask why you would ever want to do this?

0

Is loadstring not what you want?