Reserved Server Data?

In my game, players vote on a map in the lobby place. Then, on the server sided scripts it reserves a server for them. How can I transfer the server data (which map was most voted in the lobby) over to the reserved server?

Use MessagingService. MessagingService | Roblox Creator Documentation

MessagingService can send data from one server to another.

Ok so, I’ve tried using MessagingService, but it’s not working. What did I do wrong?

Here’s my code in the lobby

local ReservedServer = TPService:ReserveServer(Id)
print("game server id: "..ReservedServer)
-- Send game data
MessagingService:PublishAsync(ReservedServer, {Map = name})

Here’s my code in the reserved server place

local GameData = nil
local GameDataConnection = MessagingService:SubscribeAsync(game.PrivateServerId, function(d)
	GameData = d

You should look into the new :TeleportAsync() function. This allows you to use the TeleportOptions instance, which allows you to set teleport data that can be retrieved upon getting teleported to the new server.

You can look into the resources more below:


I hope this helps!

1 Like

Whenever I teleport a player I also need to send the player’s data. I use :TeleportToPrivateServer() and :GetJoinData() to retrieve the player’s data. However, I need to transfer the non-individual data like what map was voted on.

Could it be that the data is being sent before the connection is made?