How do i make a server browser similar to r2da's

Okay i want to make a server browser that is like r2da’s
example:

I want to be able to create a server, view other servers, view the player count, owner, name of server

any ideas on how to do this?

1 Like

I’m not familiar with this game but I believe this implements the use of MessagingService. The script most likely sends a message to all servers and requests data to be sent back to display this information.

The structure is probably similar to this:

MessagingService:SubscribeAsync("ReceiveServerInfo", function(...)
    -- Do stuff with information provided
    -- Namely update the UI. It would be best to have the servers send their
    -- server id to be able to update a reference whenever a change in info
    -- occurs
end)

MessagingService:PublishAsync("RequestServerInfo")

Servers that are meant to respond to this message should implement a SubscribeAsync to "RequestServerInfo" that would use PublishAsync to send the server info you desire.

As for creating servers, that would require the use of TeleportService, and I believe you would want to look into ReserveServer.

5 Likes

How would i get all the servers to then send the message to?

MessagingService:PublishAsync will send the the message to every server that has a connected SubscribeAsync to the topic that is published. You only need to make sure that each server you want to respond with its information is Subscribed to the topic with SubscribeAsync.

Once it fires the message, the server that receives the request should respond with its own PublishAsync to a topic meant to transfer the info back to the server that is requesting the information.

1 Like

i don’t know how to say this but like does it work universally?

Like i can leave or join the server browser game and they’ll still be subscribed?

Yes, SubscribeAsync returns an RBXScriptConnection which is the same type that is returned when Connecting to an event. The server will only ‘unsubscribe’ from the topic if you call Disconnect() on the value returned by the SubscribeAsync. As long as a player is inside the server, its not actively closing or you still have the connection connected, the server should still be waiting for a request for its information.

1 Like

Thanks this helps alot!!! thirty-characters