Advertisement
darkblooood

Untitled

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