1 Replies - 278 Views - Last Post: 20 December 2018 - 11:00 AM Rate Topic: -----

#1 protexxi   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • 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   User is offline

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

Reputation: 934
  • View blog
  • Posts: 3,741
  • 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

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1