Advertisement
TheUnknownDiscord

LASERRR GUNNNNNN

Sep 10th, 2021 (edited)
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. Tool = Instance.new("Tool")
  2. Tool.Name = "Gun"
  3. Gun = Instance.new("Part")
  4. Gun.Name = "Handle"
  5. Gun.Parent = Tool
  6. Tool.Parent = workspace.Lucas_YT111
  7. Gun.Size = Vector3.new(0.147, 0.845, 1.401)
  8. Gun.Massless = true
  9. Gun.CanCollide = false
  10. local Pow = Instance.new("Sound", owner.character.Head)
  11. Pow.SoundId = "rbxassetid://1202656211"
  12. Pow.Volume = 1
  13. active = false
  14. Mesh = Instance.new("SpecialMesh")
  15. Mesh.Parent = Gun
  16. Mesh.MeshId = "http://www.roblox.com/asset/?id=3732772227"
  17. Mesh.TextureId = "http://www.roblox.com/asset/?id=3732772286"
  18. Mesh.Scale = Vector3.new(2, 2, 2)
  19. Tool.Activated:connect(function()
  20. active = true
  21. Pow:Play()
  22. wait()
  23. active = false
  24. end)
  25. local Root = Gun
  26. local function onCreateLASERR(player, Location)
  27. if active then
  28. local rng = Random.new()
  29. local LASERR = Instance.new("Part")
  30. LASERR.Name = "LASERR"
  31. LASERR.TopSurface = Enum.SurfaceType.Smooth
  32. LASERR.BottomSurface = Enum.SurfaceType.Smooth
  33. LASERR.Size = Vector3.new(1, 1, 2.5)
  34. LASERR.BrickColor = BrickColor.new("Electric blue")
  35. LASERR.Material = Enum.Material.Neon
  36. LASERR.Anchored = true
  37. LASERR.CanCollide = false
  38. LASERR.Locked = true
  39. LASERR.CFrame = Root.CFrame
  40. LASERR.Parent = workspace
  41. local maxDistance = 200
  42. local curDistance = 0
  43. local stepDistance = 4
  44. local stepWait = 0
  45. local currentPos = Root.Position
  46. local currentNormal = CFrame.new(Root.CFrame.p, Location).lookVector
  47. local function Step(overrideDistance)
  48. local params = RaycastParams.new()
  49. local direction = currentNormal * (overrideDistance or stepDistance)
  50. params.FilterType = Enum.RaycastFilterType.Blacklist
  51. params.FilterDescendantsInstances = {script.Parent.Parent}
  52. local result = workspace:Raycast(currentPos, direction)
  53. local pos
  54. if result then
  55. pos = result.Position
  56. else
  57. pos = currentPos + direction
  58. end
  59. LASERR.Size = Vector3.new(1, 1, (pos - currentPos).Magnitude)
  60. LASERR.CFrame = CFrame.new(currentPos:Lerp(pos, 0.5), pos)
  61. local oldPos = currentPos
  62. currentPos = pos
  63. if result then
  64. local norm = result.Normal
  65. local reflect = (currentNormal - (2 * currentNormal:Dot(norm) * norm))
  66. currentNormal = reflect
  67. Step(stepDistance - (pos - oldPos).Magnitude)
  68. return
  69. end
  70. curDistance = (curDistance + (pos - oldPos).Magnitude)
  71. if curDistance > (maxDistance - 500) then
  72. local d = (curDistance - (maxDistance - 500)) / 500
  73. LASERR.Transparency = d
  74. end
  75. if curDistance < maxDistance then
  76. wait(stepWait)
  77. Step()
  78. end
  79. end
  80. LASERR.Touched:connect(function(hit)
  81. if hit.Parent.Name ~= owner.Character.Name then
  82. local humanoid = hit.Parent:FindFirstChild("Humanoid")
  83. if humanoid then
  84. humanoid:TakeDamage(30)
  85. LASERR:Destroy()
  86. end
  87. end
  88. end)
  89. Step()
  90. end
  91. end
  92. local E = Instance.new("RemoteEvent",NLS([[local E = script:FindFirstChildWhichIsA("RemoteEvent")
  93. local player = game.Players.LocalPlayer
  94. local mouse = player:GetMouse()
  95.  
  96. mouse.Button1Down:Connect(function()
  97.  
  98. local Location = mouse.Hit.p
  99. E:FireServer(Location)
  100.  
  101. end)
  102. ]],owner.PlayerGui))
  103. E.OnServerEvent:Connect(onCreateLASERR)
  104. Tool.GripPos = Vector3.new(0,0,0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement