HellzReap
|
  |
| Joined: 04 May 2011 |
| Total Posts: 89 |
|
|
| 27 Apr 2013 01:59 PM |
I've been racking my brain for hours now trying to get this to work. Let me propose to you my dilemma.
If I were to create a script at, say, a script builder, or anywhere else not within the comforts of Edit mode, how on earth could I make the source anything but blank?
I understand that source is locked, but there has to be some sort of work-around for this. Can anybody help me out here? Here's an example.
Scr = Instance.new("Script") Scr.Name = "Mwahaha" Scr.Source = [[ game.Workspace.HellzReap.Head:remove() ]]
Ultimately, I'm asking if the source is locked regardless of the fact that it's blank. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
HellzReap
|
  |
| Joined: 04 May 2011 |
| Total Posts: 89 |
|
|
| 27 Apr 2013 02:02 PM |
| I know, but I feel like there has to be a way of changing the source as the script is being created. |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 27 Apr 2013 02:11 PM |
1) No, there is no workaround other than having a script that's already made which runs a script in a string value. 2) You cannot edit the source of a script from a normal script since it was locked due to, I'm guessing, 'security issues'. |
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 27 Apr 2013 02:16 PM |
script.Code.Changed:connect(function(code) loadstring(tostring(script.Code.Value))() end)
Code is a 'StringValue'. |
|
|
| Report Abuse |
|
|
HellzReap
|
  |
| Joined: 04 May 2011 |
| Total Posts: 89 |
|
|
| 27 Apr 2013 02:57 PM |
| Could you use that with the example above, please? I'm not extremely familiar with strings or their functions. |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 27 Apr 2013 03:00 PM |
| You forgot to set its parent. :3 |
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 27 Apr 2013 03:23 PM |
Note that I had everything pre-instanced when giving the code.
local Script = Instance.new("Script", Workspace) -- script that will run the edited code local StringValue = Instance.new("StringValue", Script) -- value we will be feeding the code into
StringValue.Changed:connect(function(code) -- Runs when StringValue.Value has changed loadstring(tostring(code))()-- runs the code located in the value end)
StringValue.Value = 'print("I can now load code")' -- The code you want to run
>I can now load code |
|
|
| Report Abuse |
|
|