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
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 482 |
|
|
| 19 Jun 2014 01:34 PM |
| nevermind. I named two variables the same. |
|
|
| Report Abuse |
|
Elopus001
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 482 |
|
| |
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
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 482 |
|
|
| 19 Jun 2014 01:45 PM |
| oh, have to reference it all at once. Sorry! |
|
|
| Report Abuse |
|