astronaut32

vaporwave gun

Dec 18th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. ----------VAP0R----GUN--------------------
  2. --//credits to the creator who made this//-
  3. --//and also me for editing it //--
  4. local new=Instance.new
  5. local rad=math.rad
  6. local cf=CFrame.new
  7. local v3=Vector3.new
  8. local ang=function(x,y,z)
  9. return CFrame.Angles(rad(x),rad(y),rad(z))
  10. end
  11. local player=game:service'Players'.LocalPlayer
  12. local char=player.Character
  13. local Torso=char.Torso
  14. local cam=workspace.Camera
  15. local mouse=player:GetMouse()
  16. local weld=function(a,b,c0,c1)
  17. m=Instance.new('Motor',a)
  18. m.Part0=a
  19. m.Part1=b
  20. m.C0=c0
  21. m.C1=c1
  22. return m
  23. end
  24.  
  25. snd='rbxassetid://279207384'
  26. beamm=Instance.new('Model',workspace)
  27. beamm.Name='beam'
  28.  
  29. laser=false
  30.  
  31. rs=Instance.new('Part',char)
  32. rs.Transparency=1
  33. rs.CanCollide=false
  34. rs.TopSurface,rs.BottomSurface=0,0
  35. rs.FormFactor=3
  36. rs.Size=Vector3.new(.5,.5,.5)
  37.  
  38. ls=rs:Clone()
  39. ls.Parent=char
  40.  
  41. rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf())
  42. lsw=weld(ls,char.Torso,cf(1,-.5,0),cf())
  43. raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
  44. law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
  45.  
  46. s1=Instance.new('Sound',char)
  47. s1.Volume=1
  48. s1.Pitch=1
  49. s1.Looped=true
  50. s1.SoundId=snd
  51.  
  52. particles={}
  53.  
  54. local wep=new('Part',char)
  55. wep.FormFactor=3
  56. wep.Transparency=0
  57. wep.BrickColor=BrickColor.new("Really black")
  58. wep.Material='Granite'
  59. wep.CanCollide=false
  60. wep.Size=v3(0.5,5,0.5)
  61. wep.TopSurface,wep.BottomSurface=0,0
  62. local parts=Instance.new("ParticleEmitter")
  63. parts.Parent=wep
  64. parts.Texture="rbxassetid://549244285"
  65. parts.Size = NumberSequence.new(1, 2)
  66. parts.Rate=500
  67. parts.Lifetime = NumberRange.new(0.1, 0.1)
  68. parts.RotSpeed = NumberRange.new(5000,5000)
  69. parts.Color = ColorSequence.new(Color3.new(128,0,0,128,0,0), Color3.new(128,0,0))
  70. local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
  71.  
  72. local beam=wep:Clone()
  73. beam:ClearAllChildren()
  74. beam.Material='Neon'
  75. beam.BrickColor=BrickColor.new('Really black')
  76. beam.Size=Vector3.new(3,3,1)
  77. beam.Transparency=.5
  78. beam.Anchored=true
  79. local ms=Instance.new('BlockMesh',beam)
  80. local inner=beam:Clone()
  81. inner.Transparency=0
  82. inner.Material='Neon'
  83. inner.BrickColor=BrickColor.new('Maroon')
  84. local partss=Instance.new("ParticleEmitter")
  85. partss.Parent=inner
  86. partss.Texture="rbxassetid://549244285"
  87. partss.Size = NumberSequence.new(1, 0.5)
  88. partss.Rate=5000
  89. partss.Lifetime = NumberRange.new(0.01, 0.01)
  90. partss.RotSpeed = NumberRange.new(5000,5000)
  91. partss.Color = ColorSequence.new(Color3.new(128,0,0,128,0,0), Color3.new(128,0,0))
  92. local ms2=inner.Mesh
  93.  
  94. local expl=inner:Clone()
  95. expl.Mesh:Destroy()
  96. expl.Material='Neon'
  97. expl.BrickColor=BrickColor.new('Maroon')
  98. expl.Size=Vector3.new(11,11,11)
  99. expl.Transparency=.55
  100. pl=Instance.new('PointLight',expl)
  101. pl.Color=expl.BrickColor.Color
  102. pl.Range=pl.Range*2
  103. pl.Name='light'
  104. local br=pl.Range
  105.  
  106. local exa=expl:Clone()
  107. exa.Size=Vector3.new(4,4,4)
  108. pl2=exa.light
  109.  
  110. local part=exa:Clone()
  111. part.Size=Vector3.new(1.5,1.5,1.5)
  112. pl3=part.light
  113. pms=Instance.new('BlockMesh',part)
  114.  
  115. char.Humanoid.Died:connect(function()
  116. laser=false
  117. beam.Parent=nil
  118. inner.Parent=nil
  119. expl.Parent=nil
  120. exa.Parent=nil
  121. s1:stop()
  122. end)
  123.  
  124. mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then
  125. laser=true
  126. char.Humanoid.WalkSpeed=40
  127. s1.Volume=1
  128. s1:play()
  129. end end)
  130. mouse.Button1Up:connect(function()
  131. laser=false
  132. beam.Parent=nil
  133. inner.Parent=nil
  134. expl.Parent=nil
  135. exa.Parent=nil
  136. s1:stop()
  137. end)
  138.  
  139. parti=0
  140. game:service'RunService'.Stepped:connect(function()
  141. parti=parti+1
  142. for i,v in pairs(particles) do
  143. v.CFrame=v.CFrame*CFrame.new(0,0,-.3)
  144. v.Transparency=v.Transparency+.08
  145. if v.Transparency >= 1 then
  146. v:Destroy()
  147. table.remove(particles,i)
  148. else
  149. v.Parent=beamm
  150. end
  151. end
  152. a=cam.CoordinateFrame.p
  153. b=mouse.Hit.p
  154. mhitr=Ray.new(a,(b-a).unit*999)
  155. mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm})
  156. raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
  157. law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43)
  158. if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then
  159. char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z))
  160. end
  161. if laser then
  162. beamm.Parent=workspace
  163. beam.Parent=beamm
  164. inner.Parent=beamm
  165. expl.Parent=beamm
  166. exa.Parent=beamm
  167. s1.Volume=s1.Volume-.0
  168.  
  169. ray=Ray.new((wep.CFrame*cf(0,-1.5,0)).p,((wep.CFrame*cf(0,-10,0)).p-(wep.CFrame*cf(0,-1.5,0)).p).unit*10000)
  170. hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm})
  171.  
  172. if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
  173. Instance.new('Explosion',workspace).Position=pos
  174. end
  175. if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
  176. e=Instance.new('Explosion',workspace)
  177. e.Position=pos
  178. e.BlastRadius=14
  179. e.BlastPressure=1e4
  180. end
  181. if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
  182. hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
  183. end
  184.  
  185. if parti==math.floor(parti) then
  186. par=part:Clone()
  187. table.insert(particles,par)
  188. par.Parent=beamm
  189. par.Transparency=1-s1.Volume
  190. par.light.Range=br*s1.Volume
  191. par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
  192. end
  193.  
  194. mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude
  195. ms.Scale=v3(s1.Volume,s1.Volume,mag)
  196. ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
  197. beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,1800))
  198. inner.CFrame=beam.CFrame
  199. pl.Range=br*s1.Volume
  200. pl2.Range=br*s1.Volume
  201. expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
  202. expl.Transparency=math.random(40,60)/100
  203. expl.CFrame=cf(pos)*ang(math.random(0,1800),math.random(0,1800),math.random(0,1800))
  204. exa.Size=v3(4,4,4)*s1.Volume
  205. exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  206. char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume)
  207. end
  208. end)
  209. beam.Size=Vector3.new(2,2,1)
Add Comment
Please, Sign In to add comment