player:GetJoinData() isn't giving data for me to use, why is that?

Hello fellow developers, I have an issue with the player:GetJoinData() when I use the TeleportService. The following information is what I am trying to pass through;

local teleportDataRed = {
		team = "Red",
		partnerUserId = BlueTeammate.UserId,
		partnerTeam = "Blue",
		OwnColor = Color3.fromRGB(255, 0, 0)
	}

	local teleportDataBlue = {
		team = "Blue",
		partnerUserId = RedTeammate.UserId,
		partnerTeam = "Red",
		OwnColor = Color3.fromRGB(0, 47, 255)
	}

	TeleportService:Teleport(destination, RedTeammate, teleportDataRed)
	TeleportService:Teleport(destination, BlueTeammate, teleportDataBlue)

How I am trying to get the data;

--{{ Service's }}--
local Players = game:GetService("Players")

--{{ Variables }}--
local player = Players.LocalPlayer

local joinData = player:GetJoinData()
local teleportData = joinData and joinData.TeleportData

if teleportData then
	print("Teleport data received:")
	for key, value in pairs(teleportData) do
		print(key, value)
	end

	local team = teleportData.team
	local partnerId = teleportData.partnerUserId

	local partnerTeam = teleportData.partnerTeam
	local ownColor = teleportData.OwnColor
else
	warn("No TeleportData received?")
end

It has been annoying me for a while.

1 Like

From the documentation:

The GetJoinData() method can only be used to fetch teleport data on the server. To fetch the data on the client, use TeleportService:GetLocalPlayerTeleportData().

So basically, either you should be getting the join data from a server script (which is what I recommend doing - avoid trusting the client with anything), OR change the GetJoinData thing to be TeleportService:GetLocalPlayerTeleportData()

I appreciate the help, I will try this method and see what I get.