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: Is it possible to create a script within a script?

Previous Thread :: Next Thread 
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 11:18 AM
Well basically, i remember seeing that pencil sword model, and within the model there was a script to create it in a SBer, and it created the script, and did script.Souce = [[
]]
etc

I was making a script that creates a nuke and the I want to make an on Touch script in it so when it touches something it will add an Explosion to the part it touches if its class name is equal to "Part"

So I was wondering how i would do that because me doing

s = Instance.new("Script", nuke)
s.Souce = [[

--Le Adding Explosion stuff here

]]

Doesn't work. It adds the script but northing within the script.
So if anyone knows how to do that it would be kindly appreciated if you could tell me.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
12 Apr 2013 11:21 AM
script.Source is locked

Make a string value inside a script that says LoadString:(script.StringValue)

And disable it, change the string value, and clone it and then put the clone in the workspace, then enable the clone.
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 11:24 AM
@UnBuild, Okay I kinda get what your saying, So within the main script, I create a StringValue inside the main script, then I get stuck there, Where do i put The LoadString:(script.StringValue") in? Inside the main script, It's kind of confusing for me, sorry.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
12 Apr 2013 11:27 AM
Look at this, it will help you.

http://www.roblox.com/Scripting-item?id=112557027

Its a script I made that when you say

s/--Code here


it creates a script for everything after s/

(That is, if you are a admin)
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 11:33 AM
Alright so i tried this

ss = Instance.new("Script")
ss.Parent = script
ss.Name = "DecScript"
ss.Disabled = true
sv = Instance.new("StringValue", DecScript)


To get everything inside the main script

and It is failing to work e.e no errors eaither

Because I making the script were you can basiclly run it somewhere and it will create everything within the script instead of making it a model
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
12 Apr 2013 11:37 AM
Nopppp

Look inside the "BlankScript"


Then look inside the "AdminScript" thingy
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 11:41 AM
Yes, I understand what your doing but it requires for it to already be there. then cloning and enabling the script, First I'd need to create the BlankScript, and value within the main script, and then get the Clone line after that, but when I'm creating them it wont work..If you see where I'm getting at, i was the one script to create everything so you can just run it at places with a SBer.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
12 Apr 2013 11:42 AM
In SB?

Just do

Yo = script:Clone()

Yo.(I forgot what the value in SB script was called, you can find out somewhere).Value = "YOUR SCRIPT"

Yo.Parent = Workspace


Because SB scripts work like mine
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:04 PM
I know, I know... But.. I'm trying to say i can't even get YO in yet,

ss = Instance.new("Script")
ss.Parent = script
ss.Name = "DecScript"
ss.Disabled = true
sv = Instance.new("StringValue", DecScript)


That wont work...
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:11 PM
Bump;c
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
12 Apr 2013 12:12 PM
The problem is Instance.new("Script")

If you are doing it in script builder\

just do script:Clone()
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:14 PM

You cant Insert a new script? e.e
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:14 PM
From Instance..?
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
12 Apr 2013 12:14 PM
You can't change the source of a new script.
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:24 PM
Why does this not work?

function MakeDecal()
dec = Instance.new("Decal")
dec.Texture = "http://www.roblox.com/asset/?id=2930139"
end

w = game.Workspace:GetChildren()

while true do
wait()
for i = 1, #w do
wait()
if w[i].ClassName == "Part" then
CreateDecal()
dec.Parent = w[i]
end
end
end

Have any ideas there's no output and I can't seem to find anything wrong
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:27 PM
Lol, I just noticed when I called the funciton I used the wrong name....Silly me..
Report Abuse
DailyWin is not online. DailyWin
Joined: 08 Jan 2013
Total Posts: 1581
12 Apr 2013 12:43 PM
Forgot to add a wait() do my while true do loop and lost all 200 lines of my codeFML
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