nikimario99

Hello Neighbor Chase Gun

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