From d74f94e42247ea30018b0cba0b4aecae8347a25b Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 9 Jun 2020 10:23:14 -0400 Subject: [PATCH] Create rblxemptyservers.txt --- rblxemptyservers.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 rblxemptyservers.txt diff --git a/rblxemptyservers.txt b/rblxemptyservers.txt new file mode 100644 index 0000000..dea054c --- /dev/null +++ b/rblxemptyservers.txt @@ -0,0 +1,31 @@ +(function() { + const gid = Number(window.location.pathname.split('/')[2]) || Number(prompt('Game ID to join:', '301549746')); + const url = `https://www.roblox.com/games/${gid}`; + + const searchForGame = function(gid, min, max) { + var page = Math.round((max + min) / 2); + fetch(`https://www.roblox.com/games/getgameinstancesjson?placeId=${gid}&startindex=${page}`) + .then((resp) => resp.json()) + .then(function(data) { + if (data['Collection'].length < 10 && data['Collection'].length > 0) { + var server = data['Collection'][data['Collection'].length - 1]; + console.log('Found empty server:', server, '\nCurrent Total Players:', server['CurrentPlayers'].length); + try { + eval(server['JoinScript']); + } catch(e) { + console.log('Error:', e); + } + return true; + } else if (data['Collection'].length == 0) { + max = page; + console.log('Page empty, trying new page:', page); + searchForGame(gid, min, max); + } else { + min = page; + console.log('Not empty, trying new server:', page); + searchForGame(gid, min, max); + } + }) + } + searchForGame(gid, 0, 10000); +})();