Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 10 years ago

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.

:]

0
Please be more descriptive in your titles. AmericanStripes 610 — 10y

5 answers

Log in to vote
0
Answered by
drahsid5 250 Moderation Voter
10 years ago

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.

Ad
Log in to vote
4
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago

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.

Log in to vote
0
Answered by 10 years ago

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.

Log in to vote
0
Answered by 10 years ago

Pizza C:

Log in to vote
-1
Answered by 10 years ago

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

Answer this question