If you use teleportservice to create private servers then you’ll need to use database to keep a list off all available servers. This is fundementally impossible to do flawlessly.
Sometimes a server crash and there is no way you can update the server list.
Using onClose doesn’t work because the server just crashed!
You can’t check if a server is active or not.
You can’t check if theres players in any given private server.
Basically you can’t do a serverlist that doesn’t eventually include ghost servers.
You should make sure your server never crash - is not a logical counter argument.
You can’t make sure your game has 0 bugs
You can’t promis that the server is stable.
You can’t make sure your game is 100% unhackable.
If you think you can then don’t bother replying, go back to your software developing utopia.
This is why I suggest a method for easily getting all servers; reserved aswell as normal servers.
The returned list should include basic stuff such as: Playercount, teleport id, gameid, etc.
UPDATE:
As I’ve tried to create my own serverlist using databases I’ve run into a serious issue. ‘If a game requests the same key too many times, then its requests can be throttled or even error.’ -Wiki
This throttling disables all updates of the serverlist once you reach x amount of servers active; effectivily annihilating the last possibility of using databases as a serverlist option.
This makes the need for GetAllServers all the more critical.
Super nice! Would be able to not only get accurate player counts on your game, but to also be able to actually have a well customly deisgned server browser!
Well I mean there areeeee ways to tell if a server is still active. Have it ping the data store with a time and when another servers looks through the server list and sees that the server hasn’t pinged in for a while just remove it from the list
You wouldn’t be updating it across all servers since not all servers are going to be going through the list and if all servers are still running there is no point in setting anything on the data store.
You could have an OrderedDataStore with timestamps as values and reserved server ids as keys. They “ping” the datastore by updating their key every x minutes. You can see the latest active servers by bringing up the top n entries.
But this is sloppy and reliable api for getting all available servers is preferable.
What is the use case for this functionality? What problem are you trying to solve by getting a list of all the servers? How are you going to use it? Perhaps there may be other ways to solve the same problem without some of the limitations that this solution has. We will be looking into improve teleports and would like to understand what the issues are before we start working on solutions.
The way it’s set up is one key called ServerList.
It’s a table containing sub tables for each server.
serverlist = {}
serverlist[1] = {Name = “Vip server”, Players = 3, Maxplayers = 20, …}
serverlist[2] = {Name = “Normal server”, Players = 20, Maxplayers = 20, …}
When a server is created, it adds itself to the serverlist table.
Each server is set to update the ‘Players’ value every 120 seconds.
If a server shutsdown it will remove itself from the serverlist.
These updates always use this kind of operation:
game:GetService("DataStoreService"):GetGlobalDataStore():UpdateAsync("ServerList", function(oldValue)
local t = oldValue or {}
for i,sett in pairs(t) do
if sett.ID = SERVER_ID then
manipulate your server settings here.
end
end
return t
end)
And once enough of servers are active, this table is updated so frequently that it’s being throttled 100% of the time. That’s when nothing gets updated and the whole system collapse.
Yes, but why do you need a server list? What are you going to use that list for in your game? What is the problem that you are trying to solve by having the server list?
I have custom servers.
Some only want to fight zombies and thats why I got zombie servers.
Some only want to fight eachother, so i got battlestation servers.
Some wants to customize what maps and gamemodes to play, so I got vip servers.
Everyone wants to customize maxplayers, so I got those options too.
Previously I used 1 Place for each setting, 6 different places to update everytime I added something.
But due to frequent connection issues and the will to fully customize your own sever, aswell as the ability to choose what customized server you wanted to play on, i created the new server system.
Same as OP. I want guildmasters to be able to create private servers for their guild, and when players join the game they’re prompted with a list of all their guilds’ (they can be in multiple) active servers.
I have a beefy server so it’s nothing for me to send a http request every 5 seconds in every server and send an http request to get a list of all servers. But not everyone has the luxery of being able to pelt millions of requests from roblox games to a dedicated server on a regular basis, and I pay a pretty hefty pricetag for my server, so native support for this would be pretty neat.