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: Clone() Efficiency...

Previous Thread :: Next Thread 
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
13 Jun 2014 04:06 PM
How could this be more efficient? How could the scripts all clone into a different brick no matter what?

Script1 = Game.Lighting.Scripts.Script1:Clone()
Script2 = Game.Lighting.Scripts.Script2:Clone()
Script3 = Game.Lighting.Scripts.Script3:Clone()
Script4 = Game.Lighting.Scripts.Script4:Clone()
Script5 = Game.Lighting.Scripts.Script5:Clone()
local Children = Game.Workspace.Parts:GetChildren()
Script1.Parent = Children[math.random(1, #Children)]
Script2.Parent = Children[math.random(1, #Children)]
Script3.Parent = Children[math.random(1, #Children)]
Script4.Parent = Children[math.random(1, #Children)]
Script5.Parent = Children[math.random(1, #Children)]
Report Abuse
solarDEV is not online. solarDEV
Joined: 23 May 2014
Total Posts: 1767
13 Jun 2014 04:07 PM
What is the need to clone all that stuff from lightning?
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
13 Jun 2014 04:09 PM
Anyone?
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
13 Jun 2014 04:16 PM
No one can make this more efficient?
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
13 Jun 2014 04:18 PM
for i = 1,5 do
Clone = game.Lighting.Scripts["Script" .. i ]:Clone()
Clone.Parent = Game.Workspace.Parts:GetChildren()[math.random(#Children)]
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Jun 2014 04:31 PM
local parts = Game.Workspace.Parts:GetChildren();

for key = 1, 5 do
local randomScript = game.Lighting.Scripts["Script" .. key]:Clone();
randomScript.Parent = table.remove(parts, math.random(#parts));
end

So no 2 will be together
Report Abuse
marioblox1094 is not online. marioblox1094
Joined: 14 Aug 2010
Total Posts: 1839
13 Jun 2014 04:33 PM
Why are you using Lighting? You should move your scripts to ServerStorage and pull them from there.
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