I’m having a problem with getting teleport data to show up in the destination. I’m using TeleportOptions:SetTeleportData() to set the data to be sent in the lobby, but the issue is that I don’t seem to be getting it on the receiving end using Player:GetJoinData(). The error monitoring from Roblox isn’t showing any warnings or errors with the teleport, even though I have warnings posted. So I have no idea what is going on with this. I wish that I could see the print messages from a live server. So how do I troubleshoot this?
Try using TeleportService:GetLocalPlayerTeleportData()
and TeleportService:LocalPlayerArrivedFromTeleport()
to check if they came from a teleport.
Then you can send this information to the server if you really need it, also, I really can’t help you with the issue unless you provide some code. So some samples might be useful.
did you use protected calls or pcall()
?
Do you allow direct joins to the second place? Maybe someone is not teleporting but joining a friend directly.
@JAcoboiskaka1121 Due to security concerns, using the client is out of the question. I did secure the data via encryption and various error checking, so the data cannot be viewed or modified.
@Placewith5s I’m using Roblox’s own teleport code which includes the use of pcall()
. That code can be found here: Teleport Between Places
@solsort500 Direct joins are not allowed. If a player attempts it, they will be immediately kicked from the server.
Part of the issues that I’m encountering is that it seems that the monitoring does not capture every warning message.
Have you tried printing what the Pcall returns? And you can click F9 to see print messages in a live server in the developer console if I’m not misunderstanding
Well, your code should look like this:
local data = {'string',1,2,3}
local placeid = 12345
local teleportOptions = Instance.new('TeleportOptions')
teleportOptions:SetTeleportData(data)
--// REMEMBER the use of pcall(), this is an example
teleportService:TeleportAsync(placeid, {players}, teleportOptions)
On the receiving end, it should look like this
Players.PlayerAdded:Connect(function(player:Player)
local joinData = player:GetJoinData();
local teleportData = game:GetService('RunService'):IsStudio() and {'We cant teleport in studio :P'} or joinData.TeleportData;
print(teleportData[1]) -- 'string'
end)
Now, if you dont get any teleport data even if everything is set up correctly then that must be a bug on roblox’s end.
Ok, so I did some checking and I am definitely not getting the join data coming through.
That launch data being blank/nil is concerning since there is no data coming through with the player. The teleport happens and there are no errors. So I have no idea what’s wrong with this.
This is part of the sending code:
-- Generate Send Data
local data = {
gameMode = gameId;
gameVariant = 0;
mapId = mapInfo.ident;
from = {
jobId = game.JobId;
placeId = game.PlaceId;
gameId = game.GameId;
};
}
-- Encrypt Send Data
local state = crypto.xes.setKey(config.crypto.key)
local cdata = crypto.encryptTablePackage(state, data, config.crypto.crcSecret)
-- Teleport
local options = Instance.new("TeleportOptions")
options:SetTeleportData(cdata)
local success, result, final = teleport.safeTeleport(mapInfo.placeId, plist, options)
This is the code on the receiving end:
-- Get Teleport Data
local function playerGetTeleportData(step: number, player: Player): nil
if DEBUG == true then
print(string.format("Player Step %01d: Get Player Teleport Data: %s",
step, player.Name))
end
if runService:IsStudio() == false then
warn("Running on Live Server")
local cdata = player:GetJoinData()
print(type(cdata))
utility.printTableRecursive(cdata)
if type(cdata.TeleportData) == "table" then
warn("Teleport Data Received")
local data = crypto.decryptTablePackage(cryptoState, cdata, config.crypto.crcSecret)
if type(data) ~= "table" then
player:Kick("Exploit Detected")
end
setGameDataTeleport(data.TeleportData)
else
warn("Teleport Data *NOT* Received")
end
else
warn("Running in Studio, No Teleport Data Available")
end
return nil
end
Have you tried without the encryption?
it seems you are checking if the TeleportData is a table on the receiving end (which would be true), but you dont even get any data in first place
local cdata = player:GetJoinData()
if type(cdata.TeleportData) == "table" then
warn("Teleport Data Received")
else
warn("Teleport Data *NOT* Received")
end
The issue might be here
local data = {
gameMode = gameId;
gameVariant = 0;
mapId = mapInfo.ident;
from = {
jobId = game.JobId;
placeId = game.PlaceId;
gameId = game.GameId;
};
}
local cdata = crypto.encryptTablePackage(state, data, config.crypto.crcSecret)
You should send the data without the encryption as a test:
local data = {
gameMode = gameId;
gameVariant = 0;
mapId = mapInfo.ident;
from = {
jobId = game.JobId;
placeId = game.PlaceId;
gameId = game.GameId;
};
}
local options = Instance.new("TeleportOptions")
options:SetTeleportData(data)
local success, result, final = teleport.safeTeleport(mapInfo.placeId, plist, options)
if that works, you should check your encryption method
It’s not the crypto. It’s a block cipher that I wrote. The packaging function converts the data to JSON, encrypts it, adds the CRC and other things for error checking. Everything is working by itself and together, except getting the data through the teleport. Taking your suggestion, I disabled the crypto and I now get the data through the teleport. But when turning it back on, the data does not go through. Here’s what I’m getting in both cases on the target place:
This works:
Not working:
And what prints in the lobby with crypto on:
The encrypted package IS a table. So at this point, it appears that Roblox has a bug where the TeleportService has a problem sending binary data through it. So this is something that only Roblox can fix. Furthermore, when the bug is triggered, there are no errors…just no data.
I have been able to confirm that this is a bug in the engine as I have tested this in a bug demonstration place with the bare minimum that is required to make it happen, and it’s doing it there. So at this point, a bug report has been issued to have them take a look at this. You can find this bug report at the link below.
Passing binary data through Teleport Service causes the data to not show up in the receiving place.
A big thank you goes to @JAcoboiskaka1121 @SoftV1se @Placewith5s @hexdevotion @solsort500 who helped me sort this out.
Cheers