Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. Me = game.Players.yfc
  2. Cam = workspace.CurrentCamera
  3. --Me.Character = nil
  4.  
  5. Pos = Vector3.new(100, 1, 0)
  6. PartSize = 10
  7. UnAnchoredSize = 5
  8.  
  9. function getAllParts(from)
  10. local t = {}
  11. function getParts(where)
  12. for i, v in pairs(where:children()) do
  13. if v:IsA("BasePart") then
  14. if v.Parent ~= char and v.Parent.Parent ~= char then
  15. table.insert(t, v)
  16. end
  17. end
  18. getParts(v)
  19. end
  20. end
  21. getParts(workspace)
  22. return t
  23. end
  24.  
  25. function RayCast(pos1, pos2, maxDist, forward, from)
  26. local list = getAllParts(from)
  27. local pos0 = pos1
  28. for dist = 1, maxDist, forward do
  29. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  30. for _, v in pairs(list) do
  31. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  32. local s = v.Size
  33. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) then
  34. return pos0, v
  35. end
  36. end
  37. end
  38. return pos0, nil
  39. end
  40.  
  41. function Stats(P, Anchored, Collide)
  42. local stat = Instance.new("IntValue",P)
  43. stat.Name = "Stats"
  44. local anc = Instance.new("BoolValue",stat)
  45. anc.Name = "Anchor"
  46. anc.Value = Anchored
  47. local col = Instance.new("BoolValue",stat)
  48. col.Name = "Collide"
  49. col.Value = Collide
  50. return stat
  51. end
  52.  
  53. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  54. local p = Instance.new("Part")
  55. p.formFactor = "Custom"
  56. p.Anchored = Anchor
  57. p.CanCollide = Collide
  58. p.Transparency = Tran
  59. p.Reflectance = Ref
  60. p.BrickColor = BrickColor.new(Color)
  61. p.TopSurface = "Smooth"
  62. p.BottomSurface = "Smooth"
  63. p.Size = Vector3.new(X, Y, Z)
  64. if Break then
  65. p:BreakJoints()
  66. else p:MakeJoints() end
  67. p.Parent = Parent
  68. return p
  69. end
  70.  
  71. Model = Instance.new("Model",workspace.Base)
  72. --Cam.CameraSubject = nil
  73.  
  74. for x = 0, PartSize*5, PartSize do
  75. for z = 0, PartSize*5, PartSize do
  76. local p = Part(Model, true, false, 0, 0, "Dark green", PartSize, math.random(2, 20), PartSize, true)
  77. p.CFrame = CFrame.new(Pos) * CFrame.new(x, p.Size.Y/2, z)
  78. Stats(p, true, true)
  79. local hm = math.random(1,6)
  80. if hm == 1 then
  81. local p2 = Part(Model, true, false, 0, 0, "Bright red", math.random(UnAnchoredSize/2, UnAnchoredSize*1.5), math.random(UnAnchoredSize/2, UnAnchoredSize*1.5), math.random(UnAnchoredSize/2, UnAnchoredSize*1.5), true)
  82. p2.CFrame = p.CFrame * CFrame.new(0, (p2.Size.Y/2) + (p.Size.Y/2) + 4, 0)
  83. Stats(p2, false, true)
  84. end
  85. end
  86. end
  87.  
  88. for _, v in pairs(Model:children()) do
  89. for _, v2 in pairs(Model:children()) do
  90.  
  91. end
  92. end
  93.  
  94. if script.Parent ~= nil then
  95. local Hop = Instance.new("HopperBin",Me.Backpack)
  96. Hop.Name = "Physics"
  97. script.Parent = Hop
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement