Party system in game

Hi everyone,

I am making a game (still in very early stage) but I was wondering how I should make a group system in my game.
I was first thinking of making it so you join a server for max 1 person and with messaging service you can create a group with other people and let them teleport all players into a new place where you can have max 4 people.

But… How can I make it so no one else that isn’t in the party can join that server and that when they want to add someone else later they can invite them to their party (“server”)?

You can use ReservedServers using TeleportService

https://developer.roblox.com/en-us/api-reference/function/TeleportService/ReserveServer
https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPrivateServer

Yeah I know about that but I have been experimenting with it and When i save the code of the reserved server I can’t use this again to let another player join it on a later time

You should be able to just fine. You sure you’re storing the code correctly?

You would have to add each player to a playertable each time they join with the messaging service.

	local playertable = {}
	 for i , v in pairs 

(for each player in the place you stored the player’s name(for example replicated Storage)

		wait()
		if game.Players:FindFirstChild(v.Value) then
			table.insert(playertable,game.Players:FindFirstChild(v.Value))
		end

Then use reserve server to teleport everyone to the table so no one else can teleport

	local reserve = TP:ReserveServer(place)
	TP:TeleportToPrivateServer(stuff)
1 Like

Wich data type is the reserved code?
is it an integer or a string?

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!

3 Likes

Thanks for the clear explanation. I just played with the code around and saved it into a datastore and I finally figured it out so also thanks to @Volieb for telling me that I can save it.
I hope it will work my party system but with your explanation I am sure it will.

Have a great day!

1 Like

Great to hear! Direct message me on here if you need any further help. :slightly_smiling_face: