yeete

EH IDK

Jan 17th, 2021 (edited)
822
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Debris = game:GetService("Debris")
  2.  
  3. local LaserGun = script.Parent
  4. local Tip = LaserGun.Tip
  5.  
  6. local Player = game.Players.LocalPlayer
  7. local Character = Player.Character
  8.  
  9. local GunDamage = 99999
  10.  
  11.  
  12. LaserGun.Equipped:Connect(function(Mouse)
  13.     Mouse.Button1Down:Connect(function()
  14.         local Laser = Ray.new(Tip.CFrame.p, (Mouse.Hit.p - Tip.CFrame.p).unit * 300)
  15.         local HitPart, HitPosition = game.Workspace:FindPartOnRay(Laser, Character, false, true)
  16.    
  17.         local LaserBeam = Instance.new("Part", game.Workspace)
  18.         LaserBeam.BrickColor = BrickColor.new("Baby blue")
  19.         LaserBeam.FormFactor = "Custom"
  20.         LaserBeam.Material = "Neon"
  21.         LaserBeam.Transparency = 0.25
  22.         LaserBeam.Anchored = true
  23.         LaserBeam.CanCollide = false
  24.  
  25.         local LaserDistance = (Tip.CFrame.p - HitPosition).Magnitude
  26.         LaserBeam.Size = Vector3.new(6, 6, LaserDistance)
  27.         LaserBeam.CFrame = CFrame.new(Tip.CFrame.p, HitPosition) * CFrame.new(0, 0, -LaserDistance/2)
  28.  
  29.         Debris:AddItem(LaserBeam, 0.5)
  30.  
  31.         if HitPart then
  32.             local HitHumanoid = HitPart.Parent:FindFirstChild("Humanoid")
  33.  
  34.             if not HitHumanoid then
  35.                 HitHumanoid = HitPart.Parent.Parent:FindFirstChild("Humanoid")
  36.             end
  37.  
  38.             if HitHumanoid then
  39.                 HitHumanoid:TakeDamage(GunDamage)
  40.             end
  41.         end
  42.     end)
  43. end)
  44.  
RAW Paste Data