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

Edit localScripts help?

Is it possible to edit whats inside a script using another script, if so, please explain how, or if there is something in the roblox wiki that can help, please provide link. For example:

--If I where to do something like this
Instance.new("LocalScript", Workspace)

How do I edit whats inside the LocalScript using another script? Is it possible?

1 answer

No it is not, for security reasons, though It is somewhat unsafe to do this and rarely would it be necessary for you to do this.


There is a Source property, however, it cannot be written in game; only by the command bar / other elevated security contexts.


. If you need to accomplish something similar, though, you can use loadstring which turns a string into a function which could be run.


A common way of overcoming this is cloning a Script/LocalScript with these contents:

loadstring(script.Code.Value)();

(Where Code is a StringValue inside of the Script/LocalScript).

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