Advertisement
Guest User

fireworks

a guest
Jul 4th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. game.Lighting.TimeOfDay = 0
  2.  
  3. cols = {"Bright yellow", "Bright green", "Bright blue", "Bright red"}
  4.  
  5. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  6. part.Parent = parent
  7. part.formFactor = form
  8. part.CanCollide = collide
  9. part.Transparency = tran
  10. part.Reflectance = ref
  11. part.Size = Vector3.new(x,y,z)
  12. part.BrickColor = BrickColor.new(color)
  13. part.TopSurface = 0
  14. part.BottomSurface = 0
  15. part.Anchored = anchor
  16. part.Locked = true
  17. part:BreakJoints()
  18. end
  19.  
  20. function weld(w, p, p1, a, b, c, x, y, z)
  21. w.Parent = p
  22. w.Part0 = p
  23. w.Part1 = p1
  24. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  25. end
  26.  
  27.  
  28. function modelfirework(pos, color)
  29. local fw = Instance.new("Model")
  30. fw.Name = "xSFireWorks"
  31. local stick = Instance.new("Part")
  32. prop(stick, fw, true, 0, 0, 0.3, 1.6, 0.3, "Reddish brown", false, "Custom")
  33. stick.CFrame = CFrame.new(pos) * CFrame.Angles(math.random(-60,60)/100,math.random(-32,32)/10,math.random(-60,60)/100)
  34.  
  35. local main = Instance.new("Part")
  36. prop(main, fw, true, 0, 0, 0.8, 1.8, 0.8, color, false, "Custom")
  37. main.CFrame = stick.CFrame
  38. Instance.new("CylinderMesh",main)
  39.  
  40. local mw = Instance.new("Weld")
  41. weld(mw, stick, main, 0, 0, 0, 0.4, -0.9, 0)
  42.  
  43. local tip = Instance.new("Part")
  44. prop(tip, fw, true, 0, 0, 0.8, 0.6, 0.8, color, false, "Custom")
  45. tip.CFrame = main.CFrame
  46. local s = Instance.new("SpecialMesh",tip)
  47. s.MeshId = "http://www.roblox.com/asset/?id=1033714"
  48. s.Scale = Vector3.new(0.41,0.85,0.41)
  49.  
  50. local tw = Instance.new("Weld")
  51. weld(tw, main, tip, 0, 0, 0, 0, -1.2, 0)
  52.  
  53. local teq = Instance.new("Part")
  54. prop(teq, fw, true, 0, 0, 0.2, 0.5, 0.2, color, false, "Custom")
  55. teq.CFrame = main.CFrame
  56.  
  57. local ew = Instance.new("Weld")
  58. weld(ew, main, teq, 0, 0, 0, 0, 1.05, 0.3)
  59.  
  60. local bp = Instance.new("BodyPosition",main)
  61. bp.P = 4500
  62. bp.position = main.Position
  63. bp.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  64.  
  65. local bg = Instance.new("BodyGyro",main)
  66. bg.P = 20000
  67. bg.cframe = CFrame.new(main.Position, main.CFrame * CFrame.new(0,0,-2).p)
  68. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  69.  
  70. fw.Parent = workspace
  71.  
  72. return fw, main, stick, teq, mw, bp, bg
  73. end
  74.  
  75. launch = function(pos, color, distance, speed)
  76. local model, main, stick, teq, mw, bp, bg = modelfirework(pos, color)
  77. wait(0.5)
  78. local f = Instance.new("Fire",teq)
  79. f.Size = 0
  80. f.Heat = -5
  81. wait(0.5)
  82. for i=-5,-25,-0.4 do
  83. wait()
  84. f.Heat = i
  85. end
  86. wait(0.8)
  87. mw:remove()
  88. stick:remove()
  89. local p = main.CFrame
  90. for i=0,distance,speed do
  91. bp.position = p * CFrame.new(0,i,0).p
  92. wait()
  93. end
  94. model:remove()
  95. return bp.position
  96. end
  97.  
  98. fires = {
  99. function(pos, color, dist, speed)
  100. local boompos = launch(pos, color, dist, speed)
  101. for i=0,360,20 do
  102. local p = Instance.new("Part")
  103. prop(p, workspace, false, 1, 0, 1, 1, 1, 1, false, "Brick")
  104. p.CFrame = CFrame.new(boompos) * CFrame.Angles(0,math.rad(i),0)
  105. p.Velocity = p.CFrame.lookVector * 180
  106. local r, g, b = math.random(0,1), math.random(0,1), math.random(0,1)
  107. Instance.new("Fire",p).Color = Color3.new(r,g,b)
  108. end
  109. end,
  110. function(pos, color, dist, speed)
  111. local boompos = launch(pos, color, dist, speed)
  112. for i=0,360,20 do
  113. local p = Instance.new("Part")
  114. prop(p, workspace, false, 1, 0, 1, 1, 1, 1, false, "Brick")
  115. p.CFrame = CFrame.new(boompos) * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,0,-2)
  116. local poz = p.CFrame
  117. local r, g, b = math.random(0,1), math.random(0,1), math.random(0,1)
  118. Instance.new("Fire",p).Color = Color3.new(r,g,b)
  119. local bp = Instance.new("BodyPosition",p)
  120. bp.P = 10000
  121. bp.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  122. bp.position = p.Position
  123. coroutine.resume(coroutine.create(function()
  124. for i=0,720, 16 do
  125. bp.position = poz * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,0,i/4).p
  126. wait()
  127. end
  128. p:remove()
  129. end))
  130. end
  131. end
  132. }
  133.  
  134. for i=1,15 do
  135. local rand = math.random(1,#fires)
  136. coroutine.resume(coroutine.create(function()
  137. fires[rand](Vector3.new(math.random(-200,200),3,math.random(-200,200)), cols[math.random(1,#cols)], math.random(180,300), math.random(150,300)/100)
  138. end))
  139. wait(math.random(40,100)/10)
  140. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement