Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to edit a script's Source from another script?

So, I know you can edit them via opening them in studio. But is it possible that you can edit a script with another script? Just asking.

:]

1 comment

0

Please be more descriptive in your titles.

5 answers

✓ Accepted answer

No, you can't- sadly. I believe scripts have something like script.source, which is 'sposed to be the script's string, but I also believe it is locked/non-editable. check more out here.

A script's source cannot be read or modified by other scripts. Plugins are an exception to this rule - they have a higher permission level.

The only way is using ModularScripts, but you have to create them. I do not know much about them, you will have to look at the blog.

I'm pretty sure script.Source is read-only, meaning you can't edit it. But, you could do this.

Make a script that is disabled, and has the following source:

loadstring(script.Src.Value)()

Of course, it has to have a StringValue named "Src" inside it. Then, when you want to use it, do something like this.

local s = Workspace['ScriptName']:Clone() --replace "ScriptName" with the name of the script

s.Src.Value = [[print("Hello world!")]]
s.Disabled = false

This discussion is preserved as it was. New answers, comments, and votes are closed.