Yay, my favorite, TeleportService.
Starting off, I am assuming you already have a table/array with the party members in your script. I will be providing instructions on how to move on from here.
I am assuming you want to teleport the players to a different place. To do that, you need to reserve a Roblox server, sort of like you do with restaurant reservations. When reserving a private server for that place, you will be given a code that you will use to teleport the table of players in the party. Here is a simple example:
local placeid = 452053425 -- The place ID you want your members to teleport to.
local teleportService = game:GetService("TeleportService")
local code = teleportService:ReserveServer(placeId) -- This will return a code, usually random characters.
print(code) -- This part can be omitted.
Now with that code you ain’t going anywhere. BUT it will be used to teleport your players after on in the script. TeleportService has a function called TS:TeleportToPrivateServer()
which accepts some parameters and will be used to teleport our party members to the private server. The parameters needed for this function go as follow:
Note: There are more parameters to this function but they are completely optional and up to you, read more
here.
Moving on, we will now be using this function to teleport our party players to that specific place. Let’s move on from our previous script:
local partyMembers = {} -- Added this table to store the player instances to be teleported to the server.
local placeid = 452053425 -- The place ID you want your members to teleport to.
local teleportService = game:GetService("TeleportService")
local code = teleportService:ReserveServer(placeId) -- This will return a code, usually random characters.
print(code) -- This part can be omitted.
teleportService:TeleportToPrivateServer(placeid, code, partyMembers) -- Teleports all of our party members to that place.
There you have it! Your party members are now ready to play the game, all set up! If you need any more help, here are some useful docs from the Developer Hub:
I really hope my post contributed to your topic and will hopefully help you figure out a way to achieve the wanted result. Cheers!