Roblox Empty Server Finder

Finds an empty server for you to join.

  1. // ==UserScript==
  2. // @name Roblox Empty Server Finder
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Finds an empty server for you to join.
  6. // @author Skorpion
  7. // @match https://www.roblox.com/games/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. // Gets the game ID
  13. const gid = Number(window.location.pathname.split('/')[2]);
  14. if(!gid) return;
  15. // Gets the game URL
  16. const url = `https://www.roblox.com/games/${gid}`;
  17.  
  18. const searchForGame = function(gid, min, max) {
  19. // Get the game page
  20. var page = Math.round((max + min) / 2);
  21. // Fetch roblox's servers
  22. fetch(`https://www.roblox.com/games/getgameinstancesjson?placeId=${gid}&startindex=${page}`)
  23. // Turn the response into JSON
  24. .then((resp) => resp.json())
  25. .then(function(data) {
  26. if (data.Collection.length < 10 && data.Collection.length > 0) {
  27. var server = data.Collection[data.Collection.length - 1];
  28. console.log('Found empty server:', server, '\nCurrent Total Players:', server.CurrentPlayers.length);
  29. if(confirm("Found server with " + server.CurrentPlayers.length + " players.\nWould you like to join this server?")) {
  30. try {
  31. eval(server.JoinScript);
  32. } catch(e) {
  33. console.log('Error:', e);
  34. };
  35. } else {
  36. min = page;
  37. console.log('User canceled, trying new server:', page);
  38. searchForGame(gid, min, max);
  39. return false;
  40. };
  41. return true;
  42. } else if (data.Collection.length == 0) {
  43. max = page;
  44. console.log('Page empty, trying new page:', page);
  45. searchForGame(gid, min, max);
  46. } else {
  47. min = page;
  48. console.log('Not empty, trying new server:', page);
  49. searchForGame(gid, min, max);
  50. }
  51. })
  52. }
  53.  
  54. let h3ader = document.createElement("h3")
  55. h3ader.innerHTML = "Skorpion Finder"
  56.  
  57. let btn = document.createElement("span");
  58. btn.id = "-Skorpion-findServer"
  59. btn.onclick = function() {searchForGame(gid, 0, 10000);};
  60. btn.innerHTML = "Join Empty Server"
  61. btn.className = "btn-secondary-md"
  62.  
  63. document.getElementById("game-instances").prepend(btn)
  64. document.getElementById("game-instances").prepend(h3ader)
  65. })();