I have a system for player hosted lobbies, but I can’t get the lobby settings to transfer to a reserved server. I’m not using MessagingService
because it has an unsolvable edge case and I’m not sending the settings via the teleport data in :TeleportToPrivateServer()
because it can be modified by exploiters.
The code below aren’t the full scripts, everything other than these parts function perfectly.
Main (start place) server:
local data = {
generationSeed = generationSeed,
starCount = starCount,
clusterSize = clusterSize
}
local server = teleportService:ReserveServer(94254084317259)
lobbyDataTransfer:SetAsync(server, httpService:JSONEncode({serverId=server, data=data}), 120)
teleportService:TeleportToPrivateServer(94254084317259, server, players)
Lobby (reserved) server:
game.Players.PlayerAdded:Wait()
local memoryStore = game:GetService("MemoryStoreService")
local lobbyDataTransfer = memoryStore:GetHashMap("LobbyDataTransfer")
local httpService = game:GetService("HttpService")
local rawData
local dataLoaded = game.ReplicatedStorage.DataLoaded
local tries = 3
repeat
task.wait(1)
tries -= 1
rawData = lobbyDataTransfer:GetAsync(game.PrivateServerId)
until rawData or tries <= 0