Advertisement
Gtdcomputer

Roblox Empty Servers

Jan 9th, 2020
3,980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. (function() {
  2. const gid = Number(window.location.pathname.split('/')[2]) || Number(prompt('Game ID to join:', '1537690962'));
  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. if (server['CurrentPlayers'].length < 2) {
  13. console.log('Found empty server:', server, '\nCurrent Total Players:', server['CurrentPlayers'].length);
  14. try {
  15. eval(server['JoinScript']);
  16. } catch(e) {
  17. console.log('Error:', e);
  18. }
  19. return true;
  20. } else {
  21. console.log('Not found, try again');
  22. searchForGame(gid, 0, 10000);
  23. }
  24. } else if (data['Collection'].length == 0) {
  25. max = page;
  26. console.log('Page empty, trying new page:', page);
  27. searchForGame(gid, min, max);
  28. } else {
  29. min = page;
  30. console.log('Not empty, trying new server:', page);
  31. searchForGame(gid, min, max);
  32. }
  33. })
  34. }
  35. searchForGame(gid, 0, 10000);
  36. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement