BINO2002

Untitled

Mar 13th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. ----// Laser of death and destruction - Oblivion idk
  2.  
  3.  
  4. local p = game.Players.LocalPlayer
  5.  
  6. local char = p.Character
  7.  
  8. local mouse = p:GetMouse()
  9.  
  10. local soundPart
  11.  
  12.  
  13.  
  14.  
  15. local soundStart = Instance.new("Sound",char.Torso)
  16.  
  17. soundStart.Volume = 0.25
  18.  
  19. soundStart.SoundId = "rbxassetid://407239668"
  20.  
  21.  
  22.  
  23.  
  24. local soundRun = Instance.new("Sound",char.Torso)
  25.  
  26. soundRun.Volume = 0.1
  27.  
  28. soundRun.Looped = true
  29.  
  30. soundRun.SoundId = "rbxassetid://407218731"
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. local down = false
  39.  
  40.  
  41.  
  42.  
  43. function FireLaser(a, b)
  44.  
  45. if (soundPart) then
  46.  
  47. soundPart.CFrame = b
  48.  
  49. end
  50.  
  51. local a2 = Instance.new("Part", char)
  52.  
  53. local b2 = Instance.new("SpecialMesh", a2)
  54.  
  55. b2.MeshType = "Cylinder"
  56.  
  57. a2.Material = "Neon"
  58.  
  59. a2.BrickColor = BrickColor.new(char.Torso.BrickColor.Name)
  60.  
  61. a2.TopSurface = "Smooth"
  62.  
  63. a2.BottomSurface = "Smooth"
  64.  
  65. a2.Anchored = true
  66.  
  67. a2.CanCollide = false
  68.  
  69. a2.Transparency = 0
  70.  
  71. local c = Instance.new("ParticleEmitter", a2)
  72.  
  73. c.Color = ColorSequence.new(a2.BrickColor.Color, Color3.new(1, 1, 1))
  74.  
  75. c.Size = NumberSequence.new(0.1, 0.2)
  76.  
  77. c.Lifetime = NumberRange.new(0.3, 0.7)
  78.  
  79. c.Rate = 12
  80.  
  81. c.EmissionDirection = "Right"
  82.  
  83. c.Speed = NumberRange.new(6, 12)
  84.  
  85. c.VelocitySpread = 5
  86.  
  87. local function CreateRegion3FromLocAndSize(Position, Size)
  88.  
  89. local SizeOffset = Size/2
  90.  
  91. local Point1 = Position - SizeOffset
  92.  
  93. local Point2 = Position + SizeOffset
  94.  
  95. return Region3.new(Point1, Point2)
  96.  
  97. end
  98.  
  99. local reg = CreateRegion3FromLocAndSize(b.p, Vector3.new(10, 10, 10))
  100.  
  101. local index = 0
  102.  
  103. local small = 1000
  104.  
  105. local purts = {}
  106.  
  107. for i, v in pairs(game.Workspace:FindPartsInRegion3WithIgnoreList(reg, char:GetChildren(), 100)) do
  108.  
  109. table.insert(purts, v)
  110.  
  111. end
  112.  
  113. for i, v in pairs(purts) do
  114.  
  115. if (b.p - v.Position).magnitude < small and v.Name ~= "Baseplate" and not v:FindFirstChild("SurfaceGui") and v.Name ~= "Base" and v ~= workspace.Terrain then
  116.  
  117. small = (b.p - v.Position).magnitude
  118.  
  119. index = i
  120.  
  121. end
  122.  
  123. end
  124.  
  125. if index ~= 0 then
  126.  
  127. b = purts[index].CFrame
  128.  
  129. end
  130.  
  131. local dis = (a.p - b.p).magnitude
  132.  
  133. a2.Size = Vector3.new(dis, 0.2, 0.2)
  134. b2.Scale = Vector3.new(0, 1, 1)
  135.  
  136. a2.CFrame = CFrame.new(a.p, b.p) * CFrame.new(0, 0, -dis / 2) * CFrame.Angles(0, math.rad(90), 0)
  137.  
  138. for i = 1, 0, -0.1 do
  139.  
  140. b2.Scale = Vector3.new(1, i, i)
  141.  
  142. wait()
  143.  
  144. end
  145.  
  146. a2:Destroy()
  147.  
  148. pcall(function() purts[index]:Destroy() end)
  149.  
  150. wait(1)
  151.  
  152. --t:Destroy()
  153.  
  154. end
  155.  
  156.  
  157.  
  158.  
  159. mouse.Button1Down:connect(function()
  160.  
  161. down = true
  162.  
  163. local t = Instance.new("Part", char)
  164.  
  165. t.Size = Vector3.new(0.2, 0.2, 0.2)
  166.  
  167. t.Anchored = true
  168.  
  169. t.CanCollide = false
  170.  
  171. t.Transparency = 1
  172.  
  173. local s = Instance.new("Sound", t)
  174.  
  175. s.Looped = true
  176.  
  177. s.SoundId = "rbxassetid://407218786"
  178.  
  179. soundPart = t
  180.  
  181. s:play()
  182.  
  183.  
  184.  
  185. local c = Instance.new("ParticleEmitter", t)
  186.  
  187. c.Color = ColorSequence.new(char.Torso.BrickColor.Color, Color3.new(1, 1, 1))
  188.  
  189. c.LightEmission = 1
  190.  
  191. c.Size = NumberSequence.new(0.2, 0.3)
  192.  
  193. c.Lifetime = NumberRange.new(0.3, 0.7)
  194.  
  195. c.Rate = 200
  196.  
  197. c.EmissionDirection = "Back"
  198.  
  199. c.Speed = NumberRange.new(5, 10)
  200.  
  201. c.VelocitySpread = 100
  202.  
  203.  
  204.  
  205. soundStart:play()
  206.  
  207. soundRun:play()
  208.  
  209. end)
  210.  
  211.  
  212.  
  213.  
  214. mouse.Button1Up:connect(function()
  215.  
  216. down = false
  217.  
  218. if (soundPart) then
  219.  
  220. soundPart.Sound:stop()
  221.  
  222. soundPart:Destroy()
  223.  
  224. end
  225.  
  226. soundStart:stop()
  227.  
  228. soundRun:stop()
  229.  
  230. end)
  231.  
  232.  
  233.  
  234.  
  235. game:GetService("RunService").Heartbeat:connect(function()
  236.  
  237. if down then
  238.  
  239. FireLaser(char.Torso.CFrame, mouse.Hit)
  240.  
  241. end
  242.  
  243. end)
Add Comment
Please, Sign In to add comment