Advertisement
Descaii

Fireworks

Mar 7th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.44 KB | None | 0 0
  1. --FireWork--
  2. Player = game.Players.LocalPlayer
  3. Mouse = Player:GetMouse()
  4. function Emitter(Part,Color)
  5.         local EM = Instance.new("ParticleEmitter",Part)
  6.         EM.Size = NumberSequence.new(1,1)
  7.         EM.Rate = 50
  8.         EM.Color = ColorSequence.new(Color and Color.Color or Color3.new(1,1,1))
  9.         EM.LifeTime = NumberRange.new(0.5)
  10.         EM.Speed = NumberRange.new(10)
  11.         EM.VelocitySpread = 180
  12. end
  13. function Path(Block,Speed,Color)
  14.         local Parts = {}
  15.         game:GetService("RunService").Stepped:connect(function()
  16.                 if Block:IsDescendantOf(Workspace) then
  17.                         local P = Parts[#Parts]
  18.                         if P then
  19.                                 local G = Instance.new("Part",Workspace.CurrentCamera)
  20.                                 if Color then
  21.                                         G.BrickColor = Color
  22.                                 end
  23.                                 G.Anchored = true
  24.                                 G.FormFactor = "Custom";G.CanCollide = false
  25.                                 G.TopSurface = "Smooth"
  26.                                 G.BottomSurface = "Smooth"
  27.                                 G.Material = "Neon"
  28.                                 local Dis = ((P.CFrame*CFrame.new(0,0,-P.Size.Z/2)).p-Block.CFrame.p).magnitude
  29.                                 G.Size = Vector3.new(1,1,Dis)
  30.                                 G.CFrame = CFrame.new((P.CFrame*CFrame.new(0,0,-P.Size.Z/2)).p,Block.CFrame.p)*CFrame.new(0,0,-Dis/2)
  31.                                 Emitter(G,Color)
  32.                                 table.insert(Parts,G)
  33.                         else
  34.                                 local G = Instance.new("Part",Workspace)
  35.                                 G.Anchored = true
  36.                                 G.FormFactor = 'Custom'
  37.                                 G.Size = Vector3.new(0,0,0)
  38.                                 G.Material = "Neon"
  39.                                 Emitter(G,Color)
  40.                                 G.CFrame = Block.CFrame
  41.                                 table.insert(Parts,G)
  42.                         end
  43.                 end
  44.                 for i,v in pairs(Parts) do
  45.                         if v.Transparency < 1 then
  46.                                 v.Transparency = v.Transparency +Speed
  47.                         else
  48.                                 table.remove(Parts,i)
  49.                                 v:Destroy()
  50.                         end
  51.                 end
  52.         end)
  53. end
  54. Parts = {}
  55. function NewPart()
  56.         local Part = Instance.new("Part",Workspace.CurrentCamera)
  57.         Part.Anchored = true
  58.         Part.CanCollide = false
  59.         Part.Size = Vector3.new(1,1,1)
  60.         Part.Material = "Neon"
  61.         local B = {}
  62.         B.Velocity = Vector3.new(0,0,0)
  63.         B.P = Part
  64.         table.insert(Parts,B)
  65.         return B
  66. end
  67. function Launch(C1,C2,A,Color)
  68.         local Part = NewPart(Color)
  69.         Part.P.CFrame = C1
  70.         Path(Part.P,0.1,Color)
  71.         if Color then
  72.                 Part.P.BrickColor = Color
  73.                 Emitter(Part.P,Color)
  74.         end
  75.         Part.Velocity = (C1.p-C2.p)*A
  76.         return Part.P
  77. end
  78. Amount = 10
  79. mt = math.random
  80. game:GetService("RunService").RenderStepped:connect(function()
  81.         for i,v in pairs(Parts) do
  82.                 if v.P:IsDescendantOf(Workspace) and v.P.CFrame.Y > 0 then
  83.                         v.P.CFrame = v.P.CFrame+v.Velocity/10
  84.                         v.Velocity = v.Velocity -Vector3.new(0,0.5,0)
  85.                 else
  86.                         v.P:Destroy()
  87.                         table.remove(Parts,i)
  88.                 end
  89.         end
  90. end)
  91. --Mouse.Button1Down:connect(function()
  92. while wait(5) do
  93.         local Color = BrickColor.random()
  94.         local Pos = CFrame.new(math.random(-500,500),0,math.random(-500,500))
  95.         local P = Pos+Vector3.new(mt(-50,50),-mt(200,600),mt(-50,50))
  96.         local MS = Launch(Pos+Vector3.new(0,10,0),P,0.5)
  97.         Path(MS,0.1)
  98.         wait(1);MS:Destroy()
  99.         local M = Instance.new("Part",Workspace.CurrentCamera);M.Transparency = 1;M.CFrame = P;M.CanCollide = false
  100.         local S = Instance.new("Sound",M);S.SoundId = "http://www.roblox.com/asset/?id="..157878578;S.Volume = 20;S:Play()
  101.         for i = 1,math.random(20,50) do
  102.         Instance.new("PointLight",Launch(MS.CFrame,MS.CFrame+Vector3.new(mt(-100,100),-mt(0,150),mt(-100,100))+(-MS.Velocity),0.2,Color)).Range = 20
  103.         end
  104. end
  105. --end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement