Teleport data wont work

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

booostingggggggg so i can have more viewr

Does it work if you use TeleportService:GetLocalPlayerTeleportData() from the client instead? The docs mention this function but not Player:GetJoinData(), though I think GetJoinData should work too.

Part of the docs for TeleportToPrivateServer:

teleportData: Variant

Optional data to be passed to the destination place. Can be retrieved using TeleportService:GetLocalPlayerTeleportData().

local TeleportData = { UserId = plr.UserId }
local teleportOptions = Instance.new("TeleportOptions")

You need to add this in your place 2

im not sending the data using a local player script im using a server script so i cant use that method.

boosting the chat so i can get an answer

Teleport data is always sent through the client, that’s why it’s not secure. If you want something secure, you should use DataStores.

You can check for it using a local script like so:

local TeleportService = game:GetService("TeleportService")
print(TeleportService:GetLocalPlayerTeleportData())

Manually replicating the data from the client to the server is just as secure as using the server compatible function.

thank you for your help but i found the solution!

1 Like

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