Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I go about joining specific servers in a universe?

Asked by
Ortron 27
7 years ago

I know the basics of how teleportservice works but how would I detect how many people are in a universe server and what would I use to be able to let them teleport to that specific server?

1 answer

Log in to vote
0
Answered by 7 years ago

Roblox hasn't provided support for these actions at this time (not directly, anyway).

You need to use DataStores to communicate between servers (this is very complicated since there are many limits to work around, including an undocumented "200 requests per 10 seconds per key" limit) or create your own custom server that Roblox servers would have to communicate with using HTTPService. (If you don't have a good computer lying around that can stay on 24/7, you'll want to rent one -- obviously this costs money. And if you don't know how to program it, then this won't work anyway.)

Servers know their own JobId (which is what is required to teleport a player to a specific server). You'll need to have the servers communicate this to the external server (or to the DataStores) along with player counts. If you use DataStores, note that communication is a lot slower - it may take several seconds for servers to communicate with each other. Worse, servers must not change the same keys frequently, as UpdateAsync is designed to delay for huge quantities of time if more than a couple servers try to UpdateAsync the same key (even up to a minute to resolve a conflict between just ~5 servers or so, if I recall correctly).

If you don't expect to have more than 100 (or maybe even 200) Roblox servers live at a time, you can use a single OrderedDataStore. The key might contain the server's JobId, player count, or whatever else will fit in the character limit (I believe it's 48-50 area). You'll need to convert these numbers to a string first, of course. If the value of each key is set to a number that increases with time, you'll be guaranteed that the server list is kept up-to-date (though you'll always have dead servers on the list, they'll be at the bottom with time values that are long in the past). Since servers won't be modifying the same keys, you won't lose any information and you won't run into the limitations of UpdateAsync. You can only get a sorted OrderedDataStore 5 times per minute (more if you have lots more players), so information will still travel slowly (probably 10-20 seconds), and there will be periods of time where Roblox's datastores will stop working (usually for a short period of time; less than a minute), but it's free.

Ad

Answer this question