Hello. I’m making a studio for a spinoff of 2005 Roblox named “Dino Studio” (Dino studio - Roblox). I need help with servers and joining games. Currently, when you join somebody’s game it reserves a new server but I need to find out how to make it so if there’s an already existing server it joins that (or if there’s just a better method). I’ve tried many options such as saving the JobId on a MemoryStore but it wouldn’t work. Any help would be appreciated
Server code on joining -
local teleportService = game:GetService("TeleportService")
local memory = game:GetService("MemoryStoreService")
game.ReplicatedStorage.Join.OnServerEvent:Connect(function(plr, gameid)
gameid = game.Players:GetUserIdFromNameAsync(gameid) or 1
local data = teleportService:ReserveServer(118633091946519)
--local teleportOptions = Instance.new("TeleportOptions")
--teleportOptions:SetTeleportData(tostring(gameid))
--teleportOptions.ShouldReserveServer = true
--teleportOptions.ReservedServerAccessCode = data
teleportService:TeleportToPrivateServer(118633091946519, data, {plr}, gameid, {tostring(gameid)})
end)
game.ReplicatedStorage.Edit.OnServerEvent:Connect(function(plr)
teleportService:TeleportAsync(113076132254847, {plr})
end)