Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. local tool = script.Parent
  2. local player = game:GetService("Players").LocalPlayer
  3.  
  4. tool.Equipped:connect(function(mouse)
  5. print("Tool equipped!")
  6.  
  7. mouse.Button1Down:connect(function()
  8. print("Mouse pressed!")
  9. local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
  10. local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
  11.  
  12. local beam = Instance.new("Part", workspace)
  13. beam.BrickColor = BrickColor.new("Bright red")
  14. beam.FormFactor = "Custom"
  15. beam.Material = "Neon"
  16. beam.Transparency = 0.25
  17. beam.Anchored = true
  18. beam.Locked = true
  19. beam.CanCollide = false
  20.  
  21. local distance = (tool.Handle.CFrame.p - position).magnitude
  22. beam.Size = Vector3.new(0.3, 0.3, distance)
  23. beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  24.  
  25. game:GetService("Debris"):AddItem(beam, 0.1)
  26.  
  27. if part then
  28. local humanoid = part.Parent:FindFirstChild("Humanoid")
  29.  
  30. if not humanoid then
  31. humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
  32. end
  33.  
  34. if humanoid then
  35. humanoid:TakeDamage(10000)
  36. end
  37. end
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement