Advertisement
Gomlsauresrex

Tool with Destructive Bullets

Apr 14th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. local player=game.Players.LocalPlayer
  2. local tool=Instance.new("Tool", player.Backpack)
  3. local handle=Instance.new("Part", tool)
  4. local mesh=Instance.new("SpecialMesh", handle)
  5. mesh.MeshId="rbxasset://fonts/PaintballGun.mesh"
  6. mesh.TextureId="rbxasset://textures/PaintballGunTex128.png"
  7. tool.RequiresHandle=true
  8. handle.Name="Handle"
  9.  
  10. tool.Equipped:connect(function(mouse)
  11. handle.CFrame=handle.CFrame*CFrame.Angles(180, 0, 0)
  12. print("Tool equipped!")
  13. player.Character.Humanoid.WalkSpeed=50
  14. mouse.Button1Down:connect(function()
  15. print("Mouse pressed!")
  16. local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
  17. local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
  18.  
  19. local beam = Instance.new("Part", workspace)
  20. beam.BrickColor = BrickColor.new("Bright red")
  21. beam.FormFactor = "Custom"
  22. beam.Material = "Neon"
  23. beam.Transparency = 0.25
  24. beam.Anchored = true
  25. beam.Locked = true
  26. beam.CanCollide = false
  27.  
  28. local distance = (tool.Handle.CFrame.p - position).magnitude
  29. beam.Size = Vector3.new(0.3, 0.3, distance)
  30. beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  31.  
  32. game:GetService("Debris"):AddItem(beam, 0.1)
  33.  
  34. if part then
  35. local e=Instance.new("Explosion",part)
  36. e.BlastRadius=30
  37. e.BlastPressure=1
  38. e.Position=part.Position
  39. part.Anchored=false
  40. end
  41. end)
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement