Lobby System Guidance

Hey hey! I’m making some type of lobby system where the player can join a server via a list. I’m looking for some guidance for a list that will display all currently open servers even if no players are connected to the hub game. Is there some service I can call for this?

Thanks,
orca

2 Likes

Have you tried TeleportService:ReserveServer?

You can find out more about it here.

It’s really asking a question. I’ve got the reserved server I’m just wondering would a loop display this server when there is no one in the hub game and a new player joins?

So your problem is keeping the reserved server open even if no one is in the game?

Kinda. I’m more talking displaying the option to join said reserved server at any time while there is ppl there

So wouldn’t a Global Data Store be the answer to this?

I wasn’t sure but thanks for the suggestion @Oxiousately

Here’s an example:

local DataStoreService = game:GetService("DataStoreService")
local GlobalDataStore = DataStoreService:GetGlobalDataStore()
local function addServer(accessCode)
local success, data = pcall(function()
return GlobalDataStore:GetAsync("GlobalServerList") or {}
end)
if success then
table.insert(data, accessCode)
local writeSuccess = pcall(function()
GlobalDataStore:SetAsync("GlobalServerList", data)
end)
end
end
local function getServers()
local success, servers = pcall(function()
return GlobalDataStore:GetAsync("GlobalServerList")
end)
if success then
return servers
end
end
--run TeleportService:ReserveServer() as usual
--run getServers() when you want a table of servers and addServer() when you want to add a server
2 Likes

Thanks for the reply. Will probably edit your code to fit my needs :rofl: Anyway, have a nice night/day!