Anyone know the API that is used to get all the currently open servers there is in a game?
COMMUNITY QUESTION
What the API for getting all the open servers?
1 answer
I looked through the entire list of ROBLOX APIs and didn't find any that relate to servers. I also happened to read the comments. However, unless you provide a link to the one you found so I can look through it, my answer would have to include Lua code, so here is the pseudocode for what you will have to do:
(when server is created):
(set DataStore to a game's DataStore)
(add 1 to value in DataStore)
end
(when server is deleted):
(subtract 1 from DataStore) --DataStore exists already, as we already set it when server was made
end
If you don't like my answer and insist on using a web API, then please comment a link to the web API you were saying you saw. I could figure out how to use it, and edit my answer accordingly.
1 comment
This discussion is preserved as it was. New answers, comments, and votes are closed.

13 comments
No, there isn't one. But you could make a DataStore table that adds a server into the table when the server starts, then saves it to a DataStore.
https://scriptinghelpers.org/questions/29399/is-there-a-function-for-getting-a-list-of-servers-in-your-game
@TheDeadlyPanther, considering I saw the API before, I think you're wrong.
He is right, you have to use datastores.
No, I am not wrong. If you look at the link provided, there are no API answers. Also, the wiki devs would've referenced it, which they haven't.
I refuse to use Lua for this, there is a web API and that what I want.
There is no api for it. You have to make your own way using datastores.
Either accept the answer we gave you or just don't do it at all.
Listen Kurieita, you're asking for people to do something that simply is not done by a web API unless you make it yourself. If you do not know how to make it yourself, then do the next best thing and go with user suggestion to use DataStores. Do not attempt to call people out on being wrong on the site unless you have positive the API exists and you have a link to it.
Looking into it, the game could save when a player enters a server via DataStore and use the GetOrderedDataStore function to get the list of all players who are currently in the game. Finally being able to provide a teleport option with the function GetPlayerPlaceInstanceAsync(userId) of TeleportService.
Thanks to my friend DigitalVeer, here the API link I was talking about. http://www.roblox.com/games/getgameinstancesjson?placeId=12345&startindex=0 And no I wasn't "Calling" anyone out.
There is a link that does give you the instances of a game. I'm ashamed that I'm returning to this website to find responses such as "Either accept the answer we gave you or just don't do it at all." There is an API link that does satisfy what Kurieita was asking for, and the fact that nobody here found it means that you did not exhaust your full efforts into helping Kurieita with his issue.
Additionally, M39's answer is what a proper response should be like. At least he offers an alternative, not an absolute. Do not force answer acceptances, and also, the wiki devs have referenced it. :)