Advertisement
XZTablets

Untitled

Oct 1st, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. (function() {
  2. const gid = Number(window.location.pathname.split('/')[2]) || Number(prompt('Game ID to join:', '301549746'));
  3. const url = `https://www.roblox.com/games/${gid}`;
  4.  
  5. const searchForGame = function(gid, min, max) {
  6. var page = Math.round((max + min) / 2);
  7. fetch(`https://www.roblox.com/games/getgameinstancesjson?placeId=${gid}&startindex=${page}`)
  8. .then((resp) => resp.json())
  9. .then(function(data) {
  10. if (data['Collection'].length < 10 && data['Collection'].length > 0) {
  11. var server = data['Collection'][data['Collection'].length - 1];
  12. console.log('Found empty server:', server, '\nCurrent Total Players:', server['CurrentPlayers'].length);
  13. try {
  14. eval(server['JoinScript']);
  15. } catch(e) {
  16. console.log('Error:', e);
  17. }
  18. return true;
  19. } else if (data['Collection'].length == 0) {
  20. max = page;
  21. console.log('Page empty, trying new page:', page);
  22. searchForGame(gid, min, max);
  23. } else {
  24. min = page;
  25. console.log('Not empty, trying new server:', page);
  26. searchForGame(gid, min, max);
  27. }
  28. })
  29. }
  30. searchForGame(gid, 0, 10000);
  31. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement