I want to create a server browser for my game, however, the current problem is that i don’t know where i need to start, i have questions such as if i need to use DataStore, MessagingService, or both.
I also searched in the devforum posts talking about this, but most of them are old, or not solved posts.
I’m not trying to ask for scripts, i just want to learn and know what i need to use to create a Server Browser, i need help with this, i’ll try to answer any question.
I’m not sure if this is the best way, but I would have a datastore that (when a new server is opened) would add the server to a list. It would also be removed when the server is closed.
Then, every 15 - 60 seconds, I would load the datastore on all servers (You could do it more often, but every 15 seconds should be enough.) and update the server list on a server script. Then, you just need to update each player’s GUI (or whatever else you need) to show the changes.
On the other server I will use this code to determine if it’s open
local MessagingService = game:GetService("MessagingService")
local PlayerList = {}
if game:GetService("RunService"):IsStudio() then
return
else
function ServerListAdd(Player)
PlayerList = {}
for i,v in pairs(game.Players:GetChildren(Player)) do
PlayerList[i] = v.Name
end
MessagingService:PublishAsync("ServerListM", {Players = PlayerList, ServerId = game.JobId})
while wait(5) do
for i,v in pairs(game.Players:GetChildren(Player)) do
PlayerList[i] = v.Name
end
MessagingService:PublishAsync("ServerListM", {Players = PlayerList, ServerId = game.JobId})
end
end
game.Players.PlayerAdded:Connect(function(Player)
if #game.Players:GetChildren() > 1 then
return
else
ServerListAdd(Player)
end
end)
MessagingService:SubscribeAsync("playerJoinedOnReq", ServerListAdd)
end
I don’t understand how to use the proxy, i tried to get the API you sent me with the proxy with the following link https://rprxy.xyz/proxy/v1/games/5519106179/servers/Public?sortOrder=Asc&limit=10, however, it’s an invalid link. How do i use the proxy? Thanks for reading.