Advertisement
Laith8888

Roblox Neon Laser Launcher script

Feb 6th, 2018
823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. -- there's no time to explain! --
  2. local new=Instance.new
  3. local rad=math.rad
  4. local cf=CFrame.new
  5. local v3=Vector3.new
  6. local ang=function(x,y,z)
  7. return CFrame.Angles(rad(x),rad(y),rad(z))
  8. end
  9. local player=game:service'Players'.LocalPlayer
  10. local char=player.Character
  11. local cam=workspace.Camera
  12. local mouse=player:GetMouse()
  13. local weld=function(a,b,c0,c1)
  14. m=Instance.new('Motor',a)
  15. m.Part0=a
  16. m.Part1=b
  17. m.C0=c0
  18. m.C1=c1
  19. return m
  20. end
  21. snd='rbxassetid://229425359'
  22. beamm=Instance.new('Model',workspace)
  23. beamm.Name='beam'
  24. laser=false
  25. rs=Instance.new('Part',char)
  26. rs.Transparency=1
  27. rs.CanCollide=false
  28. rs.Material = Enum.Material.Neon
  29. rs.TopSurface,rs.BottomSurface=0,0
  30. rs.FormFactor=3
  31. rs.Size=Vector3.new(.5,.5,.5)
  32. ls=rs:Clone()
  33. ls.Parent=char
  34. rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf())
  35. lsw=weld(ls,char.Torso,cf(1,-.5,0),cf())
  36. raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
  37. law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
  38. s1=Instance.new('Sound',char)
  39. s1.Volume=1
  40. s1.Pitch=1.2
  41. s1.Looped=true
  42. s1.SoundId=snd
  43. particles={}
  44. local wep=new('Part',char)
  45. wep.FormFactor=3
  46. wep.CanCollide=false
  47. wep.Size=v3(1,3,1)
  48. wep.TopSurface,wep.BottomSurface=0,0
  49. local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
  50. local beam=wep:Clone()
  51. beam:ClearAllChildren()
  52. beam.Material='Neon'
  53. beam.BrickColor=BrickColor.new('Really black')
  54. beam.Size=Vector3.new(3,3,1)
  55. beam.Transparency=.5
  56. beam.Material = Enum.Material.Neon
  57. beam.Anchored=true
  58. local ms=Instance.new('BlockMesh',beam)
  59. local inner=beam:Clone()
  60. inner.Transparency=0
  61. inner.Material='Neon'
  62. inner.BrickColor=BrickColor.new('White')
  63. local ms2=inner.Mesh
  64. local expl=inner:Clone()
  65. expl.Mesh:Destroy()
  66. expl.Material='Neon'
  67. expl.BrickColor=BrickColor.new('Black')
  68. expl.Size=Vector3.new(11,11,11)
  69. expl.Transparency=.55
  70. pl=Instance.new('PointLight',expl)
  71. pl.Color=expl.BrickColor.Color
  72. pl.Range=pl.Range*2
  73. pl.Name='light'
  74. local br=pl.Range
  75. local exa=expl:Clone()
  76. exa.Size=Vector3.new(4,4,4)
  77. pl2=exa.light
  78. local part=exa:Clone()
  79. part.Size=Vector3.new(1.5,1.5,1.5)
  80. pl3=part.light
  81. pms=Instance.new('BlockMesh',part)
  82. char.Humanoid.Died:connect(function()
  83. laser=false
  84. beam.Parent=nil
  85. inner.Parent=nil
  86. expl.Parent=nil
  87. exa.Parent=nil
  88. s1:stop()
  89. end)
  90. mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then
  91. laser=true
  92. s1.Volume=1
  93. s1:play()
  94. end end)
  95. mouse.Button1Up:connect(function()
  96. laser=false
  97. beam.Parent=nil
  98. inner.Parent=nil
  99. expl.Parent=nil
  100. exa.Parent=nil
  101. s1:stop()
  102. end)
  103. parti=0
  104. game:service'RunService'.Stepped:connect(function()
  105. parti=parti+1
  106. for i,v in pairs(particles) do
  107. v.CFrame=v.CFrame*CFrame.new(0,0,-.3)
  108. v.Transparency=v.Transparency+.08
  109. if v.Transparency >= 1 then
  110. v:Destroy()
  111. table.remove(particles,i)
  112. else
  113. v.Parent=beamm
  114. end
  115. end
  116. a=cam.CoordinateFrame.p
  117. b=mouse.Hit.p
  118. mhitr=Ray.new(a,(b-a).unit*999)
  119. mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm})
  120. raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
  121. law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43)
  122. if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then
  123. char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z))
  124. end
  125. if laser then
  126. beamm.Parent=workspace
  127. beam.Parent=beamm
  128. inner.Parent=beamm
  129. expl.Parent=beamm
  130. exa.Parent=beamm
  131. s1.Volume=s1.Volume-.002
  132. 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*999)
  133. hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm})
  134. if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
  135. Instance.new('Explosion',workspace).Position=pos
  136. end
  137. if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
  138. e=Instance.new('Explosion',workspace)
  139. e.Position=pos
  140. e.BlastRadius=14
  141. e.BlastPressure=1e4
  142. end
  143. if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
  144. hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
  145. end
  146. if parti==math.floor(parti) then
  147. par=part:Clone()
  148. table.insert(particles,par)
  149. par.Parent=beamm
  150. par.Transparency=1-s1.Volume
  151. par.light.Range=br*s1.Volume
  152. par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
  153. end
  154. mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude
  155. ms.Scale=v3(s1.Volume,s1.Volume,mag)
  156. ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
  157. beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180))
  158. inner.CFrame=beam.CFrame
  159. pl.Range=br*s1.Volume
  160. pl2.Range=br*s1.Volume
  161. expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
  162. expl.Transparency=math.random(40,60)/100
  163. expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  164. exa.Size=v3(4,4,4)*s1.Volume
  165. exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  166. char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume)
  167. end
  168. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement