generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Instance.new("Script") is pointless.

Previous Thread :: Next Thread 
HellzReap is not online. 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 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
27 Apr 2013 02:01 PM
its locked
Report Abuse
HellzReap is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. getkoed2
Joined: 11 Apr 2010
Total Posts: 1144
27 Apr 2013 03:00 PM
You forgot to set its parent. :3
Report Abuse
UFAIL2 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image