PasteBlueJelly

Donut Spawning

Apr 3rd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. MainScale = 1
  2.  
  3. function Part(P, Anch, Coll, Tran, Ref, Col, Size, Name)
  4. local p = Instance.new("Part")
  5. p.TopSurface = 0
  6. p.BottomSurface = 0
  7. p.Transparency = Tran
  8. p.Reflectance = Ref
  9. p.CanCollide = Coll
  10. p.Anchored = Anch
  11. p.BrickColor = BrickColor.new(Col)
  12. p.formFactor = "Custom"
  13. p.Size = Size
  14. if Name then p.Name = Name end
  15. p.Parent = P
  16. p.Locked = true
  17. p:BreakJoints()
  18. return p
  19. end
  20.  
  21. V3 = Vector3.new
  22. CN = CFrame.new
  23. CA = CFrame.Angles
  24. MR = math.rad
  25. MRA = math.random
  26.  
  27. function Weld(P0, P1, CF1, CF2)
  28. if P0 and P1 and CF1 and CF2 then
  29. local w = Instance.new("Weld")
  30. w.Part0 = P0
  31. w.Part1 = P1
  32. w.C0 = CF1:toObjectSpace(CF2)
  33. w.Parent = P0
  34. end
  35. end
  36.  
  37. function makeDonut(pos, Scale)
  38. local m = Instance.new("Model",workspace)
  39. m.Name = "Donut"
  40. local Donuts = {}
  41. local prevpos = nil
  42. local prevpart = nil
  43. for x = 0, 360, 20 do
  44. wait()
  45. for y = 0, 360, 20 do
  46. local s = math.abs(y-180)
  47. local col = "Brown"
  48. if (y-180) <= -40 and (y-180) >= -120 then
  49. col = "Pink"
  50. end
  51. local p = Part(m, false, true, 0, 0, col, V3((1.9+(s/43.5))*Scale, 1.95*Scale, 1*Scale))
  52. local cf = pos * CA(0, MR(x), 0) * CN(0, 0, -10*Scale) * CA(MR(y), 0, 0) * CN(0, 0, -5*Scale)
  53. p.CFrame = cf
  54. Weld(prevpart, p, prevpos, cf)
  55. prevpos = cf
  56. prevpart = p
  57. table.insert(Donuts, p)
  58. end
  59. end
  60. return Donuts
  61. end
  62.  
  63. for i = 1, 1 do
  64. local Pos = CN(MRA(-50,50), MRA(100,140), MRA(-50,50)) * CA(MR(90), 0, 0)
  65. local a = makeDonut(Pos, MainScale)
  66. end
  67.  
  68. --[[for i,v in pairs(game.Players:GetPlayers()) do
  69. coroutine.resume(coroutine.create(function()
  70. for i = 1, 5 do
  71. v.Character.Torso.CFrame = Pos * CN(0, 0, -10*MainScale)
  72. wait()
  73. end
  74. end))
  75. end]]
Add Comment
Please, Sign In to add comment