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
 

Menger Sponge Generator Adjustment

Previous Thread :: Next Thread 
Elopus001 is not online. Elopus001
Joined: 28 Aug 2011
Total Posts: 482
19 Jun 2014 01:32 PM
function spongeClone(model,iteration)
adjustment = 3^(iteration-1)
print(adjustment)
newModel = model:clone()
path = newModel:GetFullName()
adjustParts(path,iteration,0,0)
end

function adjustParts(model,x2,y2,z2)
local c = model:GetChildren() --This is line 22.
for index, child in pairs(c) do
child.Position.x = child.Position.x + x2
child.Position.y = child.Position.y + y2
child.Position.z = child.Position.z + z2
end
end

When I run this code I get this error.

12:23:37.540 - Workspace.Menger Sponge:22: attempt to call method 'GetChildren' (a nil value)
12:23:37.541 - Stack Begin
12:23:37.541 - Script 'Workspace.Menger Sponge', Line 22 - global adjustParts
12:23:37.542 - Script 'Workspace.Menger Sponge', Line 18 - global spongeClone
12:23:37.543 - Script 'Workspace.Menger Sponge', Line 46
12:23:37.543 - Stack End

So I pass in a model to spongeClone that has one part in it. It then should then pass it through to adjustParts but here it errors because of getchildren. Any ideas?
Report Abuse
Elopus001 is not online. Elopus001
Joined: 28 Aug 2011
Total Posts: 482
19 Jun 2014 01:34 PM
nevermind. I named two variables the same.
Report Abuse
Elopus001 is not online. Elopus001
Joined: 28 Aug 2011
Total Posts: 482
19 Jun 2014 01:35 PM
Wait. It still does it.
Report Abuse
Elopus001 is not online. Elopus001
Joined: 28 Aug 2011
Total Posts: 482
19 Jun 2014 01:38 PM
Hmm. Fixed most of the problems and now it doesnt want to adjust the position. Any ideas? It says that x cannot be assigned to.
Report Abuse
Elopus001 is not online. Elopus001
Joined: 28 Aug 2011
Total Posts: 482
19 Jun 2014 01:45 PM
oh, have to reference it all at once. Sorry!
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