Carry individual information from one place to another

Hello developers! :smiley:
I am making a system of games which you can play both by yourself and with others, so, to optimize and make the code easier, I made each map be in a different subplace and that the players take certain information to each one, but I always get this error:


And another thing, how could I carry the individual information, I saw that it cannot be and that they have to figure it out, my idea is to send a table that has the name of the player and the information as content, but I don’t know how to put these Also, if there is more than one piece of information that you would have to send, how would you do it?
Thanks for reading me.

Use something called TeleportData. You can retrieve the player’s TeleportData with :GetJoinData().
TeleportData is the 3rd parameter at :Teleport().

It could look like this:

local teleportData = {
    Name = "",
    Information = {
        Blablabla = "",
    },
}
1 Like

It keeps giving me error:

1 Like

Could you show me your code that you used?

1 Like

Client:

Server:
Captura de pantalla 2021-04-28 190806

The other place:
Captura de pantalla 2021-04-28 190930

1 Like

:GetJoinData() is a function of player, so you would have to use player:GetJoinData().
The TeleportData would be:

local teleportData = player:GetJoinData().TeleportData

Furthermore you should verify the TeleportData came from an approved place, as it is possible to view it or insert data from a previous teleport.

1 Like

Oh, no more error! But still something else fails me, what you get is:
Captura de pantalla 2021-04-28 191736
This asks me 2 questions:

  1. How do I send you information about each individual player?
  2. How do I get you to receive what I told you to receive?
1 Like

The printed things are the things in the TeleportData table.
I don’t really understand your questions.

1 Like

I sent it a string information, but it returns 2 numbers and the name of the table, but nothing from the string.

1 Like

You print the dictionary returned from :GetJoinData(). Please read the API reference.
TeleportData is the table in the dictionary you printed.

1 Like

But I did not put any table, if you look at the client script I return the Value of a Value, I do not give it any table.

1 Like

Please understand the API reference.
The dictionary you get from :GetJoinData() is this:

{
SourceGameId = ...,
SourcePlaceId = ...,
TeleportData = {
        --the data you want is here
    }
}

Use this code:

local joinData = player:GetJoinData()
local teleportData = joinData.TeleportData

As you saw in the scripts that I passed, I try to send a Value, but at the time of invoking it in the other place, it does not work, I made it put in the console an “XD” if TeleportData then, as you can see in the image, it He says:

This is the new script:
Captura de pantalla 2021-04-29 162714

When you call :TeleportToPrivateServer(), the 4th parameter is the spawnName. TeleportData should be the 5th instead of the 4th, so just put a nil between Players and TableInformation.

Yes, it worked, thank you very much !!! :smiley: :smiley: :smiley: