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

Is there any way to edit a script using another script?

Asked by 6 years ago

I am wondering if you can edit a script by using other scripts: Like to change the script's code with the help of another script?

1 answer

Log in to vote
1
Answered by
chomboghai 2044 Moderation Voter Community Moderator
6 years ago

Yes. Every script has a Source property which is the code that it contains.

local aScript = workspace:WaitForChild("Script1")
local otherScript = workspace:WaitForChild("Script2")
otherScript.Source = aScript.Source

The above code will set one of the script's code to the content of the other script.

Hope this helps! :)

0
You cant access a scripts source code and edit it with another script while the game is running. herrtt 387 — 6y
Ad

Answer this question