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: parts in a grid

Previous Thread :: Next Thread 
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
30 Apr 2014 01:18 PM
Lets say i want to make a script that generates an X by X grid of parts. How would I go about doing something like that?
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
30 Apr 2014 01:34 PM
You can use 2 for loops, one nested in the other, so for every x it generates 10 y

EX:
local size = 100
local squareSize = 5
for x = 1,size do
        for y = 1, size do
                local square = Instance.new("Part")
                square.Size = Vector3.new(squareSize,SquareSize,SquareSize)
                square.Anchored = true
                square.CFrame = CFrame.new(x*(squareSize/2),0,y*(SquareSize/2))
                square.Parent = Workspace
        end
end
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
05 May 2014 08:55 PM
A little editing to get them to arrange properly:


local size = 10
local squareSize = 2
for x = 1, size do
for y = 1, size do
local square = Instance.new("Part")
square.Size = Vector3.new(squareSize,squareSize,squareSize)
square.Anchored = true
square.CFrame = CFrame.new(x*(squareSize*2),0,y*(squareSize*2))
square.Parent = Workspace wait()
end wait() end


Problem is i forgot wtf i was gonna do with this O_o
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