yes. how to check if server exists with its job id
If not possible
Would it work to: Send a request to servers with messagin service and check if server job id is stored job id, if so return true, if not return false (Id khow to use mssagin service)
You could use MessagingService to contact between different servers with a table of stored ingame JobIds, here’s an example on what you could do.
However you will have to make a function to grab these preferably using RemoteFunctions if you’re trying to get them from the client.
(Keep in mind you’re going to have to make your own system on how to detect when a server is fully inactive/0 players. Unless you dont want to do that then sure.)
This would be inside a ServerScript by the way; (This will not work in STUDIO by the way.)
local MessagingService = game:GetService("MessagingService")
local DatastoreService = game:GetService("DatastoreService")
local ServerInfo = {JobId = game.JobId}
local Ids = {}
local function updateServers()
pcall(function()
MessagingService:PublishAsync("ServerId", ServerInfo)
end)
end
local function serverStart()
MessagingService:SubscribeAsync("ServerId", function(Data)
local ourData = Data
for i, b in pairs(Ids) do
if b.JobId == ourData.JobId then
table.remove(Ids, i)
end
end
if not table.find(Ids, ourData) then
table.insert(Ids, ourData)
end
end)
end
spawn(function()
serverStart()
while true do
updateServers()
task.wait(3)
end
end)
I don’t need that for server list in-game
I need that for my summon system
I need to make it one server choose at time
and Im aware that roblox can error when saving data and that will cause in inf waiting for new summon
Yes, the system uses messaging service which subscribes in each server and updates every 3 seconds, therefore everytime the Server Updates it will send the JobId since its subscribed.
So I tested with friend with 2 servers
and for some reason it seems like servers overriding the data inside
Idk how even it looks like in table (also it has some kind of number inside)