I’ve been planning how I’m going to do my search for a player available to reserve a server in another game in the same universe. but I need the search to be favorable and that is why I must use the courier service. but how should i use it?
The question that I always ask myself and ask in the forum but someone comes along who thinks I’m a professional and explains me in a technical way in the sense that they think I know a lot about the courier service…
What I want is that when the player presses a button, he sends a message to all possible servers but regulated so as not to exploit the messaging service and that when a server receives it and at the same time this other player from that server is sending it. a server is reserved for them in another game so they can fight and that.
In addition: I would also like to know how I would do it with several players (many)
Hello! Are you talking about Messaging service? As it seems like you want to send a global message between servers. I recommend reading up on the Messaging Service API Roblox Messaging Service Docs
--script 1
local messageService = game:GetService("MessagingService")
local topic = "example"
local success, failure = pcall(function() messageService:PublishAsync(topic, "This is a test") end)
if not success then
warn(failure)
end
--script 2
local messageService = game:GetService("MessagingService")
messageService:SubscribeAsync("example", function(message)
print(message.Data) -- It returns a table and Data is the data we sent to the server
print(message.Sent) -- The time our message was sent (uses Unix time)
end
SubscribeAsync(), as it runs when it receives a message from PublishAsync(); You want the topics to match since thats how roblox knows which SubstribeAsync() function is run
In addition, and it will be that you should send the name of the player and the parameter that is ready to reserve a server and that when you receive the name, send them to another game in the same universe and that no one else can join