SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.    const gid = Number(window.location.pathname.split('/')[2]) || Number(prompt('Game ID to join:', '301549746'));
  3.    const url = `https://web.roblox.com/games/${gid}`;
  4.  
  5.    const searchForGame = function(gid, min, max) {
  6.        var page = Math.round((max + min) / 2);
  7.        fetch(`https://web.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. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top