i have a simple script that sends messages to other servers, i plan on making a server list board that shows a list of all running servers with the option to join them so using messaging service seems like a good idea to send info like player count
For some reason when game:BindToClose() fires it never sends a message to other servers saying that this server is no longer running and i dont know why.
local messagingService = game:GetService("MessagingService")
task.wait(5) -- wait for the server to fully load in
messagingService:SubscribeAsync("ServerList",function(message)
print(message.Data.JobID)
print(message.Data.ShutDown)
end)
messagingService:PublishAsync("ServerList",{
["JobID"] = game.JobId,
["ShutDown"] = false
})
game:BindToClose(function())
messagingService:PublishAsync("ServerList",{
["JobID"] = game.JobId,
["ShutDown"] = true
})
print("here") -- this gets printed but it never sends message??
task.wait(5) -- make sure it has enough time to send
end)
Ive tested with an alt with private servers and i can confirm that it sends messages normally except for when the server shuts down, please help ive all ready wasted like 2 days making the ui and everything just for this to not even work xd
FYI : i need to send a message when the server shuts down so that other servers can delete its info and not show players a dead server, i dont want to use a while loop to check if a server hasnt sent a message in a while because that seems inefficient