# LUA Help

Page 1 of 1

## 1 Replies - 444 Views - Last Post: 20 December 2018 - 11:00 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=414182&amp;s=34e8639d950a2ede41c6b774c2b72e2e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 protexxi

Reputation: 0
• Posts: 37
• Joined: 08-November 14

# LUA Help

Posted 19 December 2018 - 01:48 PM

Hello all i'm trying to use a LUA script to create a box of a 10 x 10 x 10 area

```
X = 0
Y = 0
Z = 0

size = Vector3.new(3,3,3)
loop = 10

while loop > 0 do
part = Instance.new("Part")
part.Size = size

part.Position = Vector3.new(X,Y,Z)

part.Parent = workspace.Mineable

X = X + 3

loop = loop - 1
wait(1)
end

```

the current code currently makes a row of 10 along the x axis and im having brain farts on how to make it into a solid 10 x 10 x 10 cube.

p.s im trying to learn please just point me in the write direction

Is This A Good Question/Topic? 0

## Replies To: LUA Help

### #2 ndc85430

• I think you'll find it's "Dr"

Reputation: 979
• Posts: 3,858
• Joined: 13-June 14

## Re: LUA Help

Posted 20 December 2018 - 11:00 AM

Well, you're only changing the x co-ordinate in your loop. For each x, you'll need to iterate over the y and z co-ordinates too. Basically, it ends up being 3 nested loops. This should be obvious if you think about it: as you rightly said, just incrementing the value for the x co-ordinate gives you a line. So, generating pairs (x, y) will give you a plane and then you want a sequence of planes to give the cube, so you repeat the plane for each of the z values you're interested in.

This post has been edited by ndc85430: 30 December 2018 - 12:22 AM