How to teleport a group of players into the same server

I am trying to make a game where you can join a group and when the group leader click a ui everyone in the group teleports to the same server. Kind of like Entry Point and Notoriety. I am not that good at scripting so I don’t understand much about Teleport scripts and I don’t have robux to hire people.

I have tried to make those scripts myself by learning from tutorials and reading other post but I still don’t understand (unless I just couldn’t find the right one).

This is my second post and I am quite new to the forum if I did any mistakes in my post please tell me.

8 Likes

I believe you can use TeleportPartyAsync. At least, this is what I use for squad deployments for clans.

4 Likes

The TeleportPartyAsync method, part of TeleportService, allows you to teleport groups of players easily.

Below is an example of how to use this method:

local placeId = 123
local playersList = {
   game:GetService('Players').Player1,
   game:GetService('Players').Player2
}

game:GetService('TeleportService'):TeleportPartyAsync(placeId, playersList)
14 Likes

but how do you do it so until the leader clicks start or a time limit then you teleport.

You can use RemoteEvents to have the client tell the server teleport all the players.

Server

local placeId = 123
local leaderUserId = 1

local partyPlayersList = {
   game:GetService('Players').Player1,
   game:GetService('Players').Player2
}


game:GetService('ReplicatedStorage').TeleportSquad.OnServerEvent:Connect(function(player) -- Connects a function to execute when the "TeleportSquad" event is fired

   if player.UserId == leaderUserId then -- Checks if the player who clicked the start button is equal to the party leader
      game:GetService('TeleportService'):TeleportPartyAsync(placeId, partyPlayersList) -- Teleports all players in "partyPlayersList"
   end

end)

Client

StartButton.MouseButton1Click:Connect(function() -- Connects a function to execute when the client clicks the button
   game:GetService('ReplicatedStorage').TeleportSquad:FireServer() -- Fires the remote event
end)
4 Likes

Can you explain that script please?

2 Likes

To piggy back on what @UnderMyWheel said, you could have the remotes triggered like this

MouseButton1Click:connect(function()
      Remote:FireServer()
end)

You would have to flesh out the details with the button that they’re pressing and everything, but that’s the simple way to do it.

1 Like

Updated it with comments to explain each line

1 Like

Thx but can you explain how I could set the party leader?

This is just an example, but I would have a dictionary of parties containing data such as the leader and squad players.

Server

local Parties = {}

game:GetService('ReplicatedStorage').CreateSquad.OnServerEvent:Connect(function(player)

   if not Parties[player.UserId] then -- Check if the player has already created a party by attempting to index it in the "Parties" table
      Parties[player.UserId] = { -- Create the party data
         Players = {}
      }
   end

end)

Client

CreateSquadButton.MouseButton1Click:Connect(function()
   game:GetService('ReplicatedStorage').CreateSquad:FireServer()
end)
2 Likes

Is it possible to make a gui that matches with the script?

Yes, but that is something you will need to do. The code above is just examples and will need some changes and more work such as joining parties to work on production.

1 Like

Is there any tutorials that you suggest?

Sure!

A tutorial on creating GUI buttons:

A tutorial on client and server communication using remove events and functions:

May or may not be helpful, but this is a tutorial on how to make a matchmaking system:

2 Likes

Teleporting a group of players can be done with TeleportPartyAsync, but that’s not what either Entry Point or Notoriety use. TeleportPartyAsync won’t achieve your specific use case properly, it is merely a grouped version of the default teleport function.

For Entry Point and Notoriety’s specific kind of party teleporting, they make use of reserved servers and TeleportToPrivateServer. A server is created under a specific place for members of a party and each are teleported to that server.

All other learning curves come from researching the needs of your systems and experimentation. I’d like to explain to you, but that’s not quite the point of this thread. If you have any other detailed questions, you’re welcome to open a new thread specific to that situation.

Make sure to do a bit of research first and ask about things you’re uncertain of.

7 Likes

I don’t understand what you mean.

I meant that in a fairly literal sense. The base teleport function is Teleport, which only allows you to teleport a single player to a specific place. On the other hand, TeleportPartyAsync allows you to teleport multiple players to a specific place.

This is good if you don’t mind public servers, but for matchmaking this won’t work. Your use case also explained that you were looking for private matches like Entry Point and Notoriety; the above functions I mentioned will accomplish that for you. You can send a group of players to a specific place and a specific server reserved for the members of a party.

Is there a post that explain how to do it?

No, these things don’t typically come with explicit tutorials since they’re very specific use cases. You can try searching up tutorials or experimenting around with these functions on your own time, if there are any available. There may even be an open source example regarding the application of them.

https://devforum.roblox.com/search?q=reserveserver%20category%3A55