I have a system where people can get into groups/parties with other users in their lobby and I want to know if there is any possible way I could send them to the same server using the teleportation system for games.
Example: greg, derek, sarah, and molly are all in a part together, The party leader would then press start and all of them will be teleported to the same server. How would i go about teleporting them?
the only way I could think of is like this:
for i,x in pairs(game.Players:GetChildren()) do if x.Name == "Whatever" then -- [[ CODE HERE ]] -- end end
or
local groupofplayers = --Where ever your group is located for i,x in pairs(game.Players:GetChildren()) do if x.Name == groupofplayers.Name then -- [[ CODE HERE ]] -- end end
somethine like that, I'm sorry if it's not to helpful, I'm not the best at explaining stuff
local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local code = TS:ReserveServer(game.PlaceId) -- Returns a code local players = Players:GetPlayers() -- Get a list of all players TS:TeleportToPrivateServer(game.PlaceId,code,players) -- Actually teleport the players -- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen
Copied directly from the wiki.