Reserved Server Browser

  1. What do you want to achieve? Keep it simple and clear!
    A server browser for custom reserved servers, joinable and global across all servers. While also being able to create servers. Like Evade.

  2. What is the issue? Include screenshots / videos if possible!
    I never used the Reserved Server function before. Nor do I not know how to make these servers visible globally. I already made the UI for this but I just dont know where to start.
    (These are the UI’s I already made for it)


  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I checked the developer hub, but I just cant find what im looking for. I even searched up how to use Reserved Servers, but I dont have alot of knowledge about it.

I need some explaining on how to use and let players create Reserved Servers (with specific data) and make them globally visible on the server browser.

Would the servers be permanent (such as a minecraft server) or are they like matchmaking?

Permanent, until the server shuts down. Then the server will get removed from the list and holder.

1 Like

Is it okay if I make a base/template for it and send to you, so you can check it out and modify? Easier than sending a bunch of code

1 Like

Sure, that’d be great! I would like a template.

1 Like

I’m done with the template! Is it fine if I send it to you in dms?

Sorry for the late response, ofcourse its alright if you send it through DM’s.
My discord username is @juliuswashere.

To create a server browser with custom reserved servers in Roblox, you’ll need to use TeleportService, DataStores, and MessagingService to manage reserved servers and make them globally visible. Here’s a step-by-step guide to help you implement it:

  1. Understand Reserved Servers
    Reserved servers are private servers created using TeleportService:ReserveServer(). This function generates a private server code that allows teleporting players to a unique server instance.

  2. Steps to Implement the System
    A. Allow Players to Create Servers
    Create the Reserved Server

Use TeleportService:ReserveServer(placeId) to generate a reserved server code.
Store additional metadata like server name, creator, capacity, etc., in a DataStore.
Example:

local TeleportService = game:GetService("TeleportService")
local DataStoreService = game:GetService("DataStoreService")
local ServerDataStore = DataStoreService:GetDataStore("ReservedServers")

local function createReservedServer(player, serverName, maxPlayers)
    local reservedCode = TeleportService:ReserveServer(game.PlaceId)
    local serverData = {
        Creator = player.Name,
        ServerName = serverName,
        MaxPlayers = maxPlayers,
        Players = {},
        ReservedCode = reservedCode,
        CreatedAt = os.time()
    }
    ServerDataStore:SetAsync(reservedCode, serverData)
    return reservedCode
end

B. Display Available Servers (Global Server Browser)
Use a DataStore to Save Server Details

When a server is created, save its details (e.g., name, players, code) in a global DataStore.
Periodically update the server list with active servers.
Retrieve Server List

Fetch the server list from the DataStore and display it in your UI.
Example:

local function getServerList()
    local pages = ServerDataStore:ListKeysAsync()
    local servers = {}
    for _, key in ipairs(pages:GetCurrentPage()) do
        local server = ServerDataStore:GetAsync(key)
        if server then
            table.insert(servers, server)
        end
    end
    return servers
end

C. Join a Reserved Server
Fetch Server Data

Use the server code from the browser to fetch its reserved code.
Teleport Players

Use TeleportService:TeleportToPrivateServer() to send players to the reserved server.
Example:

local function joinReservedServer(player, serverCode)
    local serverData = ServerDataStore:GetAsync(serverCode)
    if serverData then
        local reservedCode = serverData.ReservedCode
        TeleportService:TeleportToPrivateServer(game.PlaceId, reservedCode, {player})
    end
end

D. Update Server Browser in Real-Time
Use MessagingService

Broadcast updates (e.g., server created, player joined/left) using MessagingService.
Example:

local MessagingService = game:GetService("MessagingService")

-- Broadcast updates
local function broadcastServerUpdate(serverData)
    MessagingService:PublishAsync("ServerUpdates", serverData)
end)

-- Listen for updates
MessagingService:SubscribeAsync("ServerUpdates", function(message)
    local updatedServer = message.Data
    -- Update the UI based on this new data
end)
  1. UI Integration
    When a player selects “Create Server,” call the createReservedServer() function and refresh the server list.
    Use the server list from getServerList() to populate your browser UI.
    When a player clicks “Join,” call joinReservedServer() with the selected server’s code.
  2. Considerations
    Server Cleanup: Remove inactive servers periodically to prevent clutter in the DataStore.
    Error Handling: Handle edge cases like full servers or invalid codes gracefully.
    Security: Ensure only valid players can join servers using the reserved codes.
    This setup should allow you to create a fully functional global server browser for reserved servers like in Evade! Let me know if you need clarification or further code examples. Hope that helps.
2 Likes

Hi, I will make sure to test it out right now. Thanks for your help and I’ll reply if it doesnt work.

So here’s my first question because I have no braincells:
Do I make this a module script or do I have to work with events (RemoteEvents, RemoteFunctions, etc)?
And where do I put this script?

Ill create a local file for you, completing what i am talking about and ill sent it over when I’m done

Ok here is the game with use of the “createReservedServer()”
Reserve Server Browser Test - Roblox
Here is the step by step prosses of what is happening in this script

  1. The player clicks the create button GUI
  2. The Client receives that the player has clicked the button
  3. The client fires through remote event to the server
  4. The server receives the call
  5. The Server clones a GUI template, customizes it, and parents it to a folder in replicated storage
  6. All the clients that are currently in the game recognize that a child has been added to the folder
  7. The clients clone the GUI and put it in there player GUI accordingly
  8. The server makes an object value whose value is the player who originally created the GUI
  9. The server renames the object value to “Owner”
  10. The server parents the owner tag to the created GUI on the server side
  11. The clients gets the owner tag and checks if there player is the owner.
  12. The client whose player is the owner gets the Created GUI locally
  13. The client changes the GUI to have a remove and start button
  14. The client whose player is not the owner will only have a join button
  15. The player clicks on the join GUI and the client fires the server
  16. The server receives the client request
  17. The server creates a new object value
  18. The server puts the new object value’s value to the player who fired the server
  19. The server parents the new object value to the folder with the owner object value
  20. The server changes the GUI to show a player has joined
  21. The owners client clicks the start button and fires to a server
  22. The server receives the fire
  23. The player gets all the object values from the folder and puts the values into a table
  24. The server creates a new private server to the new place
  25. The server gets the table with the values and puts it in the teleport function
  26. The Server sends all the players who where in the table to the place

Easier to understand when you try it.
Best used with at least 2 clients.
The game should be uncoppylocked so do with it as you please.
Feel free to ask if you have any questions.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.