Teleport data not working

it says “No TeleportData found for player” which mean the data isnt sending please help

place #2

game.Players.PlayerAdded:Connect(function(plr)
	local joinData = plr:GetJoinData() -- Updated to use GetJoinData

	if joinData and joinData.TeleportData then
		local teleportData = joinData.TeleportData
		
		local userid = teleportData.UserId
		print("Teleport Data UserId:", userid)
	else
		print("No TeleportData found for player", plr.Name)
	end
end)

place #1

local function teleportToServer(plr, serverCode)
	local id = ServerNamesDS:GetAsync(serverCode)
	local code = ServerAccessCodesDS:GetAsync(id)
	if code then
		local TeleportData = { UserId = plr.UserId }
		local teleportOptions = Instance.new("TeleportOptions")
		teleportOptions:SetTeleportData(TeleportData)
		print("Teleporting with data:", TeleportData) -- Debug line
		TS:TeleportToPrivateServer(122839632522178, code, {plr}, nil, teleportOptions)
	else
		print("Invalid or expired server code.")
	end
end
2 Likes

teleporttoprivateserver is old now. try using teleport async, and add “shouldreserveserver” into the teleport options.

1 Like

oh but i need it for the code so how do i do that

1 Like

oh but i need it for the code so how do i do that

1 Like

change that block of code to this:

local TeleportData = { UserId = plr.UserId }
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions:SetTeleportData(TeleportData)
teleportOptions.ShouldReserveServer = true
print("Teleporting with data:", TeleportData) -- Debug line
TS:TeleportAsync(122839632522178, {plr}, teleportOptions)
1 Like

but if i do that if a another player wants to join they will be tped to thier own reserved server

1 Like

i dont understand. do you mean if you want to put another player into the same private server? or you mean that you want other players to go into different servers?

1 Like

same private server, let me explain so i am making a lobby where there is 3 options create a server,join a server, and join your own server. iwant people to join a players server using a code crated

1 Like

thank you for your help but i found the solution! cya

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.