Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to keep a group of players together when traveling between places? (Answered)

Hello all, I have been working on a story game, similar to the game "Camping" if any of you have ever played that. I am trying to keep a group of players together as I have multiple places to travel between which all include a different part of the story. I want to create a new server for each group, and not let anyone from another group join a different group on a server that has already started the story. So essentially, I want to create a new server on each place that the group travels to, and not let any other group (or player) join a server that has already started the game. Thanks!

-- ItzHiimnew

2 comments

0

TeleportService has the ability to teleport multiple players to a game, or are you doing this in one game?

0

It is in multiple games, and I am using TeleportService, but I need to keep those players in the same group without joining another group.

2 answers

✓ Accepted answer

This is actually pretty simple and uses TeleportService. I have the same system in my game and it works perfectly. I'll just write you a function that will teleport every player in a table to a certain place, and no one else will be in or be able to join that server except the players in the group

Then you will be able to read on how it works Function:

function TeleportGroup(placeId,group)
       local TS = game:GetService("TeleportService")
       local key = TS: ReserveServer(placeId)
       TS:TeleportToPrivateServer(placeId,key,group)
end
-- Example:
TeleportGroup(1234,{game.Players.Bob,game.Players.Shedletsky)

2 comments

0

Maybe ItzHiimnew's awenser will be better, i posted this awenser before reading his/her's one.

0

Crap I forgot to close the table on column 20, but you can figure it out.

This discussion is preserved as it was. New answers, comments, and votes are closed.