Advertisement
Upscalefanatic3

City

Oct 3rd, 2016
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. local xSize = 100
  2. local ySizeMin = 20
  3. local ySizeMax = 200
  4. local zSize = 100
  5. local xScale = 25
  6. local zScale = 25
  7.  
  8.  
  9. xScale = xScale * xSize
  10. zScale = zScale * zSize
  11.  
  12.  
  13. local Grid = Instance.new("Model")
  14. Grid.Name = "City Grid"
  15. Grid.Parent = Workspace
  16.  
  17.  
  18. for x = -xScale / 2, xScale / 2, xSize do
  19. for z = -zScale / 2, zScale / 2, zSize do
  20. local size = math.ceil(math.random(ySizeMin, ySizeMax))
  21. local p = Instance.new("Part")
  22. p.Locked = true
  23. p.Name = "(" ..x.. ", " ..z.. ") Building"
  24. p.Anchored = true
  25. p.FormFactor = 0
  26. p.Size = Vector3.new(xSize, size, zSize)
  27. p.CFrame = CFrame.new(x, 2 + (size / 2), z)
  28. p.BrickColor = BrickColor.random()
  29. p.Parent = Grid
  30. wait()
  31. end
  32. end
  33.  
  34.  
  35. for x = -xScale / 2, xScale / 2, xSize do
  36. if math.random(1, 3) == 1 then
  37. for z = -zScale / 2, zScale / 2, zSize do
  38. for _, p in pairs(Grid:GetChildren()) do
  39. if p.Name == "(" ..x.. ", " ..z.. ") Building" then
  40. p:Remove()
  41. end
  42. end
  43. local p = Instance.new("Part")
  44. p.Locked = true
  45. p.Name = "(" ..x.. ", " ..z.. ") Road"
  46. p.Anchored = true
  47. p.FormFactor = 0
  48. p.Size = Vector3.new(xSize, 1, zSize)
  49. p.CFrame = CFrame.new(x, 2, z)
  50. p.BrickColor = BrickColor.new("Really black")
  51. p.Parent = Grid
  52. wait()
  53. end
  54. end
  55. end
  56.  
  57.  
  58. for z = -zScale / 2, zScale / 2, zSize do
  59. if math.random(1, 3) == 1 then
  60. for x = -xScale / 2, xScale / 2, xSize do
  61. for _, p in pairs(Grid:GetChildren()) do
  62. if p.Name == "(" ..x.. ", " ..z.. ") Building" or p.Name == "(" ..x.. ", " ..z.. ") Road" then
  63. p:Remove()
  64. end
  65. end
  66. local p = Instance.new("Part")
  67. p.Locked = true
  68. p.Name = "(" ..x.. ", " ..z.. ") Road"
  69. p.Anchored = true
  70. p.FormFactor = 0
  71. p.Size = Vector3.new(xSize, 1, zSize)
  72. p.CFrame = CFrame.new(x, 2, z)
  73. p.BrickColor = BrickColor.new("Really black")
  74. p.Parent = Grid
  75. wait()
  76. end
  77. end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement