Advertisement
FurkingBoi

Wild Revolver

Jun 4th, 2020
1,920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer;
  2.  
  3. local Mouse = Player:GetMouse();
  4. local MaxRange = 300;
  5. local Hotkey = Enum.KeyCode.X;
  6. local UIS = game:GetService'UserInputService';
  7. local auto = true;
  8.  
  9. function Shoot()
  10. local MyHMR = Player.Character and Player.Character.PrimaryPart;
  11. local MyData = workspace.PlayerData:FindFirstChild(Player.Name);
  12. local IsSameTeam = (MyHMR and MyHMR.Parent:FindFirstChild'CowboyHat' and true) or false;
  13. if MyHMR and MyData then
  14. for i,v in pairs(game.Players:GetPlayers()) do
  15. local HMR = v and v.Character and v.Character.PrimaryPart;
  16. local Data = workspace.PlayerData:FindFirstChild(v.Name);
  17. local Hum = HMR and v.Character:FindFirstChild'Humanoid';
  18. local Head = Hum and v.Character:FindFirstChild'Head';
  19.  
  20. if Head and Hum.Health > 0 and not (((HMR.Parent:FindFirstChild'CowboyHat' and true) or false) == IsSameTeam) then
  21. local Found = false;
  22. for ii,targ in pairs({HMR, Head}) do
  23. if not Found then
  24. local R = Ray.new(MyHMR.Position, (targ.Position-MyHMR.Position).unit*MaxRange);
  25. local P, Pos = workspace:FindPartOnRay(R, Player.Character);
  26. local p = Instance.new('Part', Player.Character);
  27. p.Anchored = true;
  28. p.Material = Enum.Material.Neon;
  29. p.CanCollide = false;
  30. p.Transparency = .5;
  31. local dist = (MyHMR.Position-Pos).magnitude;
  32. p.Size = Vector3.new(.1,.1,dist);
  33. p.CFrame = CFrame.new(MyHMR.Position, Pos)*CFrame.new(0,0,-dist/2);
  34. game:GetService('Debris'):AddItem(p, .1)
  35. if P and P:isDescendantOf(HMR.Parent) then
  36. Hum.Health = 0;
  37. local Info = {};
  38. Info.Start = MyHMR.Position;
  39. Info.HitPart = targ;
  40. Info.HitPosition = targ.Position;
  41. game.ReplicatedStorage.Events.GunFired:FireServer(Info);
  42. warn('Hit '..v.Name);
  43. Found = true;
  44. delay(1, function()
  45. if Hum and Hum.Parent then
  46. Hum.Health = 100
  47. end
  48. end)
  49. p.Color = Color3.new(0,1,0);
  50. else
  51. p.Color = Color3.new(1,0,0);
  52. end
  53. end
  54. end
  55. end
  56. end
  57. end
  58. end
  59. UIS.InputBegan:Connect(function(Key, GPE)
  60. if Key.KeyCode == Hotkey then
  61. Shoot();
  62. end
  63. end)
  64. spawn(function()
  65. while auto and wait(.1) do
  66. print'Shooting..';
  67. Shoot();
  68. end
  69. end)
  70. warn'Loaded!';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement