Advertisement
pa1nx9

Phantom Forces GRENADE FRAG BOT

Sep 9th, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. local camera = workspace.CurrentCamera;
  2. local players = game:GetService("Players");
  3. local localPlayer = players.LocalPlayer;
  4.  
  5.  
  6. local charTbl;
  7. local replicationTbl;
  8. local pfCam;
  9. local gameLogic;
  10. local network;
  11. local hud;
  12. local char;
  13. local menu;
  14.  
  15. for i,v in pairs(getgc(true)) do
  16. if type(v) == "table" then
  17. if rawget(v, "getbodyparts") then
  18. replicationTbl = v;
  19. charTbl = debug.getupvalue(v.getbodyparts, 1);
  20. end
  21. if rawget(v, "basecframe") then
  22. pfCam = v;
  23. end
  24. if rawget(v, "gammo") then
  25. gameLogic = v;
  26. end
  27. if rawget(v, "send") then
  28. network = v;
  29. end
  30. if rawget(v, "updateammo") then
  31. hud = v;
  32. end
  33. if rawget(v, "jump") then
  34. char = v;
  35. end
  36. if rawget(v, "isdeployed") then
  37. menu = v;
  38. end
  39. end
  40. end
  41.  
  42.  
  43. local function shootNade(targetPos)
  44. if gameLogic.gammo <= 0 then
  45. return;
  46. end
  47. local camCf = camera.CFrame;
  48. local rot = (camCf - camCf.Position);
  49. local args = {
  50. time = tick(),
  51. blowuptime = 0,
  52. frames = {
  53. {
  54. t0 = 0,
  55. p0 = camCf.Position,
  56. v0 = camCf.LookVector,
  57. offset = Vector3.new(),
  58. a = Vector3.new(0, -80,0),
  59. rot0 = rot,
  60. rotv = rot * Vector3.new(19, -5, 0),
  61. glassbreaks = {}
  62. },
  63. {
  64. t0 = 0,
  65. p0 = targetPos,
  66. v0 = Vector3.new(),
  67. offset = Vector3.new(),
  68. a = Vector3.new(),
  69. rot0 = CFrame.new(),
  70. rotv = Vector3.new(),
  71. glassbreaks = {}
  72. }
  73. }
  74. };
  75. network:send("newgrenade", "FRAG", args);
  76. gameLogic.gammo = gameLogic.gammo - 1;
  77. hud:updateammo("GRENADE");
  78. end
  79.  
  80. local function getCharacterInCircle(center, radius)
  81. local results = {};
  82. for player, character in pairs(charTbl) do
  83. if player.Team ~= localPlayer.Team then
  84. if character.rootpart and (character.rootpart.Position - center).Magnitude <= radius then
  85. results[#results + 1] = character;
  86. end
  87. end
  88. end
  89. return results;
  90. end
  91.  
  92. do
  93. if not (char.rootpart and menu:isdeployed()) then
  94. repeat
  95. menu:deploy();
  96. task.wait();
  97. until char.rootpart and menu:isdeployed();
  98. end
  99. task.wait(1);
  100. local targets = {};
  101. for player, character in pairs(charTbl) do
  102. if player.Team ~= localPlayer.Team then
  103. if character.rootpart and character.torso and character.head then
  104. local charsInCircle = getCharacterInCircle(character.torso.Position, 30);
  105. targets[#targets + 1] = charsInCircle;
  106. end
  107. end
  108. end
  109. table.sort(targets, function(a, b)
  110. return #a > #b;
  111. end);
  112. for i = 1, 3 do
  113. local t = targets[i];
  114. if t then
  115. for j = 1, #t do
  116. local theirChar = t[j];
  117. if theirChar and theirChar.torso then
  118. shootNade(theirChar.torso.Position);
  119. task.wait(0.1);
  120. end
  121. end
  122. end
  123. end
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement