TeleportService | TeleportData = nil?

I got it to work finally!

	local TeleportOptions = Instance.new("TeleportOptions")
	
	local code = TeleportService:ReserveServer(PlaceId)
	TeleportService:TeleportToPrivateServer(PlaceId, code, GameData["Team"])

I completely missed the part about “TeleportToPrivateServer” when I first started to read those docs yesterday, but now I also don’t have to send any data as well what makes it even better. Anyways thx for the help man.

1 Like

One more thing, so you should be able to send data with "TeleportToPrivateServer, so I gave it a try, but then it’s still nil, and apparently for other ppl it did work, and I am pretty sure that I did it exactly like them, but it doesn’t work for me. any idea why? Since I also put the arguments right as well, here is my code.

function GameManager.StartGame(GameData)
	local self = setmetatable(GameData, GameManager)
	local TeamStats = CreateStats()
	local SpawnPointUsed = {}
	print("hi")
	
	
	local TeleportOptions = Instance.new("TeleportOptions")
	local code = TeleportService:ReserveServer(PlaceId)
	TeleportService:TeleportToPrivateServer(PlaceId, code, GameData["Team"],_,GameData["Team"])
local PlayerService = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local GameManager = require(script.Parent.GameManager)




function NewPlayerJoined(Player)
	local JoinData = Player:GetJoinData()
	if JoinData then
		print("JoinDataRetrieved") -- prints a table but there is nothing in it
		for Index, Key in pairs(JoinData.TeleportData) do
			print(Key)
		end
	print("what")
	else
		print("No JoinData Found :((")
	end
	GameManager.PlayerSetUp(Player)
	
end

function PlayerLeaving(Player)
	
end







PlayerService.PlayerAdded:Connect(NewPlayerJoined)
PlayerService.PlayerRemoving:Connect(PlayerLeaving)

By other people, what do you mean?

Also, I read the docs about TeleportToPrivateServer and it states:

So I recommend you use TeleportAsync instead which does seem easier to use and is capable of doing essentially everything TeleportToPrivateServer can