TeleportData Is always nil

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to send data from the lobby to a reserved server.

  1. What is the issue? Include screenshots / videos if possible!

teleport data always prints nil

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have also tried the client receiving method which is GetLocalPlayerTeleportData()
this also does not work and prints nil.

I have used messaging service Publish & Subscribe async which works but only when there is a player on the reserved server and the server sending the message is still alive. This is not reliable.

Place1 (lobby, sends data)

				local teleportOptions = Instance.new("TeleportOptions")
				teleportOptions:SetTeleportData(serverSettings)
				
				
				local success, err = pcall(function()
					TS:TeleportToPrivateServer(placeID, serverCode, plrQueue, nil, teleportOptions)
				end)
			
				if not success then
					print("Teleport failed: " .. err)
				end

Place2 code (recieves data)


PS.PlayerAdded:Connect(function(plr)
	local joinData = plr:GetJoinData()
	local tpData = joinData.TeleportData
	
	print(tpData) -- always nil  );
end)

teleportOptions:SetTeleportData(table.clone(serverSettings))

You can’t use TeleportOptions with :TeleportToPrivateServer().

I’d change this line:
TS:TeleportToPrivateServer(placeID, serverCode, plrQueue, nil, teleportOptions)

to this:
TS:TeleportToPrivateServer(placeID, serverCode, plrQueue, nil, serverSettings)

If you would like to use TeleportOptions, use :TeleportAsync() instead.

Thank you so much! I didn’t read the documentation close enough.

1 Like