Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Retrive a List of all Private Servers created?

Im making a game where you Have a GUI where you can create your own server or join others with this script that works perfectly fine to create a server.

I want to get a list of avaible Servers using the ReserveServer and but it on the players Gui.

Script to Create the Server WORKS

local TeleportService = game:GetService("TeleportService")

local placeId = 000000000000 



game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,Type)
 if Type == "Create" then
  local player = game.Players[""..plr.Name..""]
  local access = game:GetService("TeleportService"):ReserveServer(placeId)
  game:GetService("TeleportService"):TeleportToPrivateServer(placeId,access,{player})
 end
end)

Script to Join Server DOESNT WORK

local TeleportService = game:GetService("TeleportService")

local placeId = 0000000


game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,Type)
 if Type == "Join" then
  local player = game.Players[""..plr.Name..""]
  local access = game:GetService("TeleportService"):ReserveServer(placeId)
  game:GetService("TeleportService"):TeleportToPrivateServer(placeId,access,{player})
 end
end)

Is there a way i can retrieve a List of all the avaible servers?

1 comment

0

I don't know if there is a legitimate way, but record all the private servers created in a list and then when you want to get the full list, use Messaging service to get more lists from all the other servers and then you can combine the lists to get one whole script with all the private servers. Hope this helps!

1 answer

✓ Accepted answer

A good source

And if that doesn't work you could log the servers as when the user creates a server it adds a value to a folder or just adds to a table

Example

local servers = {}

local TeleportService = game:GetService("TeleportService")

local placeId = 000000000000 



game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,Type)
 if Type == "Create" then
  local serverinfo = table.insert(servers,{servername=plr.Name.."'s server",servertype=Type})
  local player = game.Players[""..plr.Name..""]
  local access = game:GetService("TeleportService"):ReserveServer(placeId)
  game:GetService("TeleportService"):TeleportToPrivateServer(placeId,access,{player})
 end
end)

To get the lists you would just do

for _,serverlists in pairs(servers) do
	print(serverlists.servername,serverlists.servertype)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.