TeleportData Server to Server is it possible?

Is there a current way to teleport all the players in the server to another place(reserved)with data that doesn’t go through the client at all(not currency data, but something let’s say like crouching).

Edit: I tested sending teleport data, and the only way to do that is locally. The biggest problems with that is that the place that is teleported to can’t be reserved, and since data is sent locally, it isn’t safe, so datastores is probably the only way to go for this. Hope this post helps for future people.

Edit 2: Looks like it is possible to send data via server to server(solved by lesser fantasy). I just messed up putting the teleportdata in the 4th parameter(this is only for TeleportService:Teleport() and rule does not apply to TeleportService:TeleportToPrivateServer()z I still prefer using datastores(especially datastore 2 for this however lol), but it’s good info to know.

2 Likes

Your question seems pretty vague, but I assume you are referring to this.

I’m asking the game teleport data service. I’m wondering if you can teleport players to another place in the game with data that is free from exploit from the client (this is the 4th parameter). Currently the only way that I know of to get fetched data is TeleportService:GetLocalPlayerTeleportData().Thanks for the reply and for trying to help, but I’m not asking about datastores.

1 Like

No, you can’t get TeleportData safely using TeleportService.
The only way is to use DataStores.

2 Likes

The server can define and access data safely provided you have extra checks in place to prevent data reusage, one of the only caveats with server teleport data access.

From a technical standpoint: the client is used to transfer data between DataModels. This is mostly irrelevant to you since this is work the engine does to get teleport data through, only thing you need to know are the pitfalls and how to fight against them.

So from a surface standpoint yes, server-server teleport data is possible. Client will still be able to access the data and you can’t prevent that from occurring. From a technical standpoint, it isn’t because the client is used as the transfer medium.

Ephemeral DataStores should solve this use case as per their release, which then you can completely cut the client out of the equation both on a technical and surface level.

4 Likes

I read that thread, but how it works is still kind of vague.

The thing I am especially confused about is how to teleport multiple players to one private server, and be able to send teleportdata at the same time.

I don’t think it’s really that vague. The explanations are all in there and the Developer Hub is available if you need to read up on how API incorporates TeleportData as well.

Simply, instead of using GetLocalPlayerTeleportData from TeleportService, you use GetJoinData on the Player from a server script. As for sending JoinData, it’s as simple as defining it in the appropriate parameter when using a teleport function.

You seem confused about something different, which it’s good you provided clarification later on. TeleportToPrivateServer supports teleporting a group of players to a private server. The third argument is a table of players and the fifth is the TeleportData you want to send.

For an example: let’s say we want to teleport everyone of the current server to a private one and send data. We can do that in the following way:

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")

local DEFAULT_DATA = {foo = "bar"}

local onlinePlayers = Players:GetPlayers() -- Returns an array of players
local serverCode = TeleportService:ReserveServer(game.PlaceId)

TeleportService:TeleportToPrivateServer(
    game.PlaceId,
    serverCode,
    onlinePlayers,
    nil,
    DEFAULT_DATA
)

The TeleportData is now the table assigned to the variable DEFAULT_DATA. Now in a different script, we’re going to get that data from the server by using GetJoinData.

local Players = game:GetService("Players")

local function playerAdded(player)
    local joinData = player:GetJoinData()
    if joinData then
        print(joinData.TeleportData) -- Should print a table hash
    end
end

Players.PlayerAdded:Connect(playerAdded)

TeleportData is defined when you’re using teleport methods. If you check out the Developer Hub, you’ll notice all the teleport methods have a parameter for specifying TeleportData to be sent with the players.

15 Likes

Just tested it and it surprisingly works! I thought that :GetJoinData() had to be local —> server. Glad I was wrong.

1 Like

Figured I should clarify this real-quick. When accessing teleport information through GetJoinData the teleport must have been invoked by a game server. This is a security measure to validate the data that is received on the new game server.