TeleportData Trouble

I have a game where I matchmake people into a reserved server. However seeing as I can’t retrieve JoinData.Members, I have been trying to use TeleportData to send a table of information regarding how many people are in their party.

The TeleportData I set on the server of the start place:

local players = game.Players:GetChildren()
local tele_data = {
     Party = players,
}

When I call:

print(#tele_data.Party)

--Output: 0

It sends over the table fine, but somewhere along they way everything inside disappears.
I’m new to using the TeleportService so any help is greatly appreciated, thanks in advance.

I understood the cause.
You are getting the number of players.
Normally the script will be executed before the player joins.
Try add

wait(5)

on top.

This has nothing to do with it, but there are also need fixes.

game.Players:GetChildren()

to

game.Players:GetPlayers()
1 Like

Sorry I should’ve added, the code I wrote on my post is a simplification of the actual code but holds true, I know for a fact at the time of sending the player off with the TeleportToPrivateServer method, that the #Party is 1 or more. (I’ve gone through with print statements and what-not.)

However upon retrieving the data with the GetJoinData method, It seems to drop all of the items in the array.

1 Like
wait(5)
local players = game.Players:GetPlayers()
local tele_data = {
     Party = players,
}

for _,player in pairs(tele_data.Party) do
	print(player:GetJoinData().SourceGameId)
	print(player:GetJoinData().SourcePlaceId)
	print(player:GetJoinData().Members)
	print(player:GetJoinData().TeleportData)
end

Did you add this code?
This prints nil, which is normal.
The reason is running it in Roblox studio.

1 Like

The code where I set the tele_data is in the start place, and I send it as the TeleportData parameter in TeleportToPrivateServer, I use GetJoinData() in the place they are teleporting to, forgive me If I’m misinterpreting your post. I apologize if I didn’t make it clear enough in my previous posts.

And that is to say, upon joining the new place/private server, I use GetJoinData() to determine how many people were sent along with this player as to circumvent the use of JoinData.Members which can’t be used with TeleportToPrivateServer()

1 Like

I have found the issue, you can’t send player objects as items in TeleportData.

Instead, I created a table of UserIds and sent that.

1 Like

In fact, you can’t send an instance

1 Like

Actually, you can.
However, not in this case using TeleportData.