Hello, I am currently making a game with a lobby that allows players to teleport to different places with different game modes. Some of these game modes have teams that players can form before they teleport, and upon arrival I would like to be able to determine these teams.
My issue was determining the best method to do so. The most intuitive way I can see is using DataStoreService, but I wanted to avoid using them if possible. Could someone tell me the best way to go about this?
(Current strategy)
Somewhere in the teleport code in the lobby:
local serverAccessCode = TeleportService:ReserverServer(placeId)
local serverAccessKey = "server$" .. serverAccessCode
local success = pcall(dataStore.SetAsync, dataStore, serverAccessKey, serverTeleportData)
if not success then
-- some error handler
end
Somewhere in the new server’s initialization code:
local serverAccessKey = "server$" .. game.JobId
local success, result = pcall(dataStore.GetAsync, dataStore, serverAccessKey)
if success then
pcall(dataStore.RemoveAsync, dataStore, serverAccessKey) -- don't really know what to do if it fails
-- continue game stuff (result now holds the team information)
else
-- error handling logic
end