Roblox Smart Server Join

Join Roblox servers intelligently based on server size, including private servers with debugging logs

  1. // ==UserScript==
  2. // @name Roblox Smart Server Join
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.2
  5. // @description Join Roblox servers intelligently based on server size, including private servers with debugging logs
  6. // @author Kanako
  7. // @match *://www.roblox.com/*
  8. // @grant none
  9. // @license Apache License 2.0
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function to join a public server using the protocol URL
  16. function joinPublicServer(placeId, jobId) {
  17. const protocolUrl = `roblox://experiences/start?placeId=${placeId}&gameInstanceId=${jobId}`;
  18. console.log(`Joining public server with URL: ${protocolUrl}`);
  19. window.location.href = protocolUrl;
  20. }
  21.  
  22. // Function to join a private server using the protocol URL
  23. function joinPrivateServer(placeId, linkCode) {
  24. const protocolUrl = `roblox://placeid=${placeId}&linkcode=${linkCode}`;
  25. console.log(`Joining private server with URL: ${protocolUrl}`);
  26. window.location.href = protocolUrl;
  27. }
  28.  
  29. // Extract the placeId and linkCode from the URL
  30. function extractParamsFromUrl(url) {
  31. const regex = /\/games\/(\d+)\/[^?]+\?privateServerLinkCode=(\d+)/;
  32. const match = url.match(regex);
  33. if (match && match.length === 3) {
  34. console.log(`Extracted placeId: ${match[1]}, linkCode: ${match[2]}`);
  35. return { placeId: match[1], linkCode: match[2] };
  36. } else {
  37. console.error('Could not extract placeId and linkCode from URL');
  38. return null;
  39. }
  40. }
  41.  
  42. // Disable default join behavior for private servers
  43. function disableDefaultJoin() {
  44. window.addEventListener('click', function(event) {
  45. const element = event.target;
  46. if (element.tagName === 'A' && element.href && element.href.startsWith('https://www.roblox.com/games/') &&
  47. element.href.includes('privateServerLinkCode')) {
  48. event.preventDefault();
  49. }
  50. });
  51. }
  52.  
  53. // Replace current page with a blank page
  54. function replaceWithBlankPage() {
  55. const blankPageUrl = 'about:blank';
  56. console.log('Replacing page with a blank page...');
  57. window.location.replace(blankPageUrl);
  58. }
  59.  
  60. // Run the setup functions and replace with a blank page immediately
  61. disableDefaultJoin();
  62. const params = extractParamsFromUrl(window.location.href);
  63. if (params) {
  64. const { placeId, linkCode } = params;
  65. console.log('Detected private server link.');
  66. joinPrivateServer(placeId, linkCode);
  67. } else {
  68. const playButton = document.querySelector('button[data-testid="play-button"]');
  69. if (playButton) {
  70. console.log('Play button detected.');
  71. playButton.addEventListener('click', async function(e) {
  72. e.preventDefault();
  73. console.log('Play button clicked');
  74. // Add your logic to join a public server here
  75. });
  76. }
  77.  
  78. // Add logic to handle joining public servers here
  79. console.log('Searching for public server join button.');
  80. }
  81. replaceWithBlankPage(); // Replace with a blank page after setup
  82. })();