|
| 02 Oct 2012 10:12 AM |
| Greetings. I rrecently wondered if there was a way to create a script in the workspace and then edit the script's content purely by using lua. I already know how to create a new script in the workplace, but I can't find any information on how to write data to the script. I have attempted to use SaveString() on the instance, but that doesn't do anything. if anybody has any ideas, then feel free to share them here. Thank you! |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 02 Oct 2012 10:16 AM |
You cannot. Every scripts text is stored inside scripts sources, which are locked from use.
However, you could use something like this;
script.ChildAdded:connect(function(s) pcall(function() loadstsring(s.Value) end end)
Doing this;
Instance.new("StringValue", script).Value = "print('hi')" would result in
hi |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Oct 2012 10:48 AM |
| That's a bit of a bummer :( Thank you! |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 02 Oct 2012 12:01 PM |
What I told is almost the same actually.
Blame roblox, they think its a security issue. I think we should decide ourselves if its an issue or not. But whatever. |
|
|
| Report Abuse |
|
|
nairod7
|
  |
| Joined: 26 Mar 2010 |
| Total Posts: 869 |
|
|
| 02 Oct 2012 12:07 PM |
Before, you could do:
Game.Workspace.Script.Source = "print'test'"
Now, you must have a higher security identity ( like the command bar ) to use the source property. |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2012 12:11 PM |
>I think we should decide ourselves if its an issue or not. But whatever.
It is - Free Model "viruses" and the such.
As nairod7 said, you can do this, but you'll need to execute it from the Command Bar, a Studio Plugin, a CoreScript, or anything that has a higher authorization level than regular Scripts:
local a = Instance.new("Script", workspace) a.Source = 'print("Hello World!")'
But as you most likely want an actual user-made Script to do this, you'll most likely have to go with a Disabled Script that executes given code, perhaps in a StringValue inside it. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 02 Oct 2012 01:58 PM |
Above:
Yea, if you dont use free models, then you dont have to worry right? Thats what I mean with decide for yourself. |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2012 02:15 PM |
| Exploiiiiiiiiiiiiiiiiiiiiiiiiiiiiters. |
|
|
| Report Abuse |
|
|