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: Creating script instances using lua.

Previous Thread :: Next Thread 
HomelessWizard is not online. HomelessWizard
Joined: 17 Sep 2012
Total Posts: 38
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 is not online. 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
doforgetme is not online. doforgetme
Joined: 29 Apr 2011
Total Posts: 46
02 Oct 2012 10:18 AM
Ok then...
Report Abuse
HomelessWizard is not online. HomelessWizard
Joined: 17 Sep 2012
Total Posts: 38
02 Oct 2012 10:48 AM
That's a bit of a bummer :( Thank you!
Report Abuse
jobro13 is not online. 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 is not online. 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
technoguyx is not online. technoguyx
Joined: 05 Dec 2008
Total Posts: 8286
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 is not online. 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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
02 Oct 2012 02:15 PM
Exploiiiiiiiiiiiiiiiiiiiiiiiiiiiiters.
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