Advertisement
zombieslayerwtf

Anchor Laser [stacks with change laser V1]

Jun 1st, 2018
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.64 KB | None | 0 0
  1. print("Hold Q to Shoot")
  2. laser = nil
  3. laserRot = 100
  4. pos3 = Vector3.new(0,0,0)
  5. counter = 0
  6. function chargeLaser3()
  7. local part = Instance.new("Part")
  8. part.Name = "ChargingLaser3"
  9. game:GetService("Debris"):AddItem(part,1)
  10. part.Parent = game.Players.LocalPlayer.Character
  11. part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  12. part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  13. part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  14. part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  15. part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  16. part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  17. part.Material = Enum.Material.Neon
  18. part.Anchored = true
  19. part.CanCollide = false
  20. part.Size = Vector3.new(0.5,0.5,0.5)
  21. local light = math.random(50,150)
  22. local rotx = math.random(-360,360)
  23. local roty = math.random(-360,360)
  24. local rotz = math.random(-360,360)
  25. part.BrickColor = BrickColor.new('Bright blue')
  26. part.Transparency = 0.4
  27. part.CFrame = game.Players.LocalPlayer.Character["Right Arm"].CFrame:toWorldSpace(CFrame.new(Vector3.new(0,-1.1,0))) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
  28. for i=0.4,1,0.1 do
  29. wait()
  30. part.Size = Vector3.new(0.5+i,0.5+i,0.5+i)
  31. part.Transparency = i
  32. part.CFrame = game.Players.LocalPlayer.Character["Right Arm"].CFrame:toWorldSpace(CFrame.new(Vector3.new(0,-1.1,0))) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
  33. end
  34. part:remove()
  35. end
  36. function chargeLaser4()
  37. local part = Instance.new("Part")
  38. game:GetService("Debris"):AddItem(part,1)
  39. part.Name = "ChargingLaser4"
  40. part.Parent = game.Players.LocalPlayer.Character
  41. part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  42. part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  43. part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  44. part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  45. part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  46. part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  47. part.Material = Enum.Material.Neon
  48. part.Anchored = true
  49. part.CanCollide = false
  50. part.Size = Vector3.new(2,2,2)
  51. local light = math.random(50,150)
  52. local rotx = math.random(-360,360)
  53. local roty = math.random(-360,360)
  54. local rotz = math.random(-360,360)
  55. part.BrickColor = BrickColor.new('Bright blue')
  56. part.Transparency = 0.4
  57. part.CFrame = CFrame.new(pos4) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
  58. for i=0.4,1,0.1 do
  59. wait()
  60. part.Size = Vector3.new(2+i,2+i,2+i)
  61. part.Transparency = i
  62. part.CFrame = CFrame.new(pos4) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
  63. end
  64. part:remove()
  65. end
  66.  
  67.  
  68.  
  69.  
  70. game:GetService("RunService").RenderStepped:connect(function()
  71. counter = counter +1
  72. if counter >= 3 then
  73. counter = 0
  74. chargeLaser3()
  75. if laser ~= nil then
  76. chargeLaser4(pos4)
  77. end
  78. end
  79.  
  80. laserRot = laserRot+1
  81. if laser ~= nil then
  82. local pos3 = game.Players.LocalPlayer.Character.ChargingLaser3.Position
  83. pos4 = game.Players.LocalPlayer:GetMouse().Hit.p
  84.  
  85. laser.Size = Vector3.new(0.75,0.75,(pos3-pos4).magnitude)
  86. laser.CFrame = CFrame.new((pos3+pos4)/2,pos3)*CFrame.Angles(0,0,math.rad(laserRot))
  87.  
  88. local ray = Ray.new(pos3,(pos4-pos3).unit*600)
  89. local hit,position,normal = game.Workspace:FindPartOnRay(ray,game.Players.LocalPlayer.Character)
  90. if hit then
  91.  
  92.  
  93. hit.Name = "nil"
  94. hit.Material = Enum.Material.Neon
  95.  
  96. local c= hit.Color.r+hit.Color.g+hit.Color.b
  97.  
  98. c = c*255
  99. c = c/3
  100. hit.BrickColor = BrickColor.new('Bright blue')
  101. hit.Anchored = true
  102.  
  103. for _,child in pairs(hit:GetChildren()) do
  104. if child:IsA("BasePart") then
  105.  
  106.  
  107. child.Name = "nil"
  108. child.Material = Enum.Material.Neon
  109. local c= child.Color.r+child.Color.g+child.Color.b
  110.  
  111. c = c*255
  112. c = c/3
  113. child.BrickColor = BrickColor.new('Bright blue')
  114.  
  115. end
  116. if not child:IsA("BasePart") then
  117. child:remove()
  118. end
  119. end
  120. end
  121. end
  122. end)
  123. game:GetService("UserInputService").InputBegan:connect(function(key)
  124. if key.KeyCode == Enum.KeyCode.Q then
  125. game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0*CFrame.Angles(0,0,math.rad(90))
  126. laser = Instance.new("Part")
  127. laser.Name = "Laser2"
  128. laser.Transparency = 0.25
  129. laser.Parent = game.Players.LocalPlayer.Character
  130. laser.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  131. laser.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  132. laser.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  133. laser.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  134. laser.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  135. laser.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  136. laser.Material = Enum.Material.Neon
  137. laser.Anchored = true
  138. laser.CanCollide = false
  139. laser.Size = Vector3.new(0.75,0.75,0.75)
  140. laser.BrickColor = BrickColor.new('Bright blue')
  141.  
  142. end
  143. end)
  144. game:GetService("UserInputService").InputEnded:connect(function(key)
  145. if key.KeyCode == Enum.KeyCode.Q then
  146. game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0*CFrame.Angles(0,0,math.rad(-90))
  147. laser:remove()
  148. laser = nil
  149. end
  150. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement