breezyshadow012

brick house

Mar 23rd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. function _G.MakeBrickHouse(xOffset, yOffset, zOffset, xScale, yScale, zScale, anchored)
  2. xScale = xScale * 4
  3. yScale = yScale * 2
  4. zScale = zScale * 4
  5. house = Instance.new("Model")
  6. house.Name = "House"
  7. house.Parent = Workspace
  8. p = Instance.new("Part")
  9. p.Name = "Floor"
  10. p.FormFactor = 0
  11. p.Size = Vector3.new(xScale + 2, 1, zScale + 2)
  12. p.CFrame = CFrame.new(Vector3.new(xOffset, yOffset, zOffset))
  13. p.Anchored = true
  14. p.BrickColor = BrickColor.new("Pastel brown")
  15. p.Parent = house
  16. p:MakeJoints()
  17. local p1 = nil
  18. local p2 = nil
  19. for x = 2 - 0.5, yScale - 0.5, 2 do
  20. for i = 1, xScale - 2, 4 do
  21. p2 = p1
  22. p1 = Instance.new("Part")
  23. p1.Name = "Wall"
  24. p1.FormFactor = 0
  25. p1.Size = Vector3.new(4, 2, 2)
  26. p1.CFrame = CFrame.new(Vector3.new(xOffset + (i - (xScale / 2)), yOffset + x, zOffset + (zScale / 2)))
  27. p1.Anchored = true
  28. p1.BrickColor = BrickColor.new("Pastel brown")
  29. p1.Parent = house
  30. p1:MakeJoints()
  31. if (x == 1.5 or x == 3.5 or x == 5.5) and i == ((xScale - 2) / 2) then p1:Remove() end
  32. end
  33. for i = zScale - 1, 1, -4 do
  34. p2 = p1
  35. p1 = Instance.new("Part")
  36. p1.Name = "Wall"
  37. p1.FormFactor = 0
  38. p1.Size = Vector3.new(2, 2, 4)
  39. p1.CFrame = CFrame.new(Vector3.new(xOffset + (xScale / 2), yOffset + x, zOffset + (i - (zScale / 2))))
  40. p1.Anchored = true
  41. p1.BrickColor = BrickColor.new("Pastel brown")
  42. p1.Parent = house
  43. p1:MakeJoints()
  44. end
  45. for i = xScale - 1, 1, -4 do
  46. p2 = p1
  47. p1 = Instance.new("Part")
  48. p1.Name = "Wall"
  49. p1.FormFactor = 0
  50. p1.Size = Vector3.new(4, 2, 2)
  51. p1.CFrame = CFrame.new(Vector3.new(xOffset + (i - (xScale / 2)), yOffset + x, zOffset - (zScale / 2)))
  52. p1.Anchored = true
  53. p1.BrickColor = BrickColor.new("Pastel brown")
  54. p1.Parent = house
  55. p1:MakeJoints()
  56. end
  57. for i = 1, zScale - 2, 4 do
  58. p2 = p1
  59. p1 = Instance.new("Part")
  60. p1.Name = "Wall"
  61. p1.FormFactor = 0
  62. p1.Size = Vector3.new(2, 2, 4)
  63. p1.CFrame = CFrame.new(Vector3.new(xOffset - (xScale / 2), yOffset + x, zOffset + (i - (zScale / 2))))
  64. p1.Anchored = true
  65. p1.BrickColor = BrickColor.new("Pastel brown")
  66. p1.Parent = house
  67. p1:MakeJoints()
  68. end
  69. end
  70. p = Instance.new("Part")
  71. p.Name = "Ceiling"
  72. p.Size = Vector3.new(xScale + 2, 1, zScale + 2)
  73. p.CFrame = CFrame.new(Vector3.new(xOffset, yOffset + yScale + 1.1, zOffset))
  74. p.Anchored = true
  75. p.BrickColor = BrickColor.new("Bright red")
  76. p.Parent = house
  77. p:MakeJoints()
  78. if anchored == false then
  79. Children = house:GetChildren()
  80. for i = 1, #Children do
  81. Children[i].Anchored = false
  82. end
  83. end
  84. return house
  85. end
  86.  
  87.  
  88. _G.MakeBrickHouse(100, 1, 0, 7, 5, 7, false)
Add Comment
Please, Sign In to add comment