How can I use :TeleportPartyAsync() but pass on player data?

So what I want to do is teleport a party of players but pass on data for each player. I want to use the function :TeleportPartyAsync() and let’s say I want to pass on a random number for each player. How would I do this? I tried looking at the docs and it didn’t make alot sense to me.

TeleportPartyAsync() has a teleportData parameter that can be passed on in the 3rd argument. You can create a table and an index for every player, value being the data that they hold, e.g:

local teleportData = {}
for _, player in pairs(players) do

    teleportData[player.Name] = math.random(1, 10)


TeleportService:TeleportPartyAsync(placeId, players, teleportData)

Then you can retrieve the data with Player:GetJoinData(), and use the TeleportData key, which is the table created, and specify their index with their name to get their value:

-- players as in service "Players"

    local teleportData = player:GetJoinData().TeleportData

    if teleportData then -- if they got teleported with data

        local playerData = teleportData[player.Name]

        print(playerData) -- outputs an integer from 1-10, this was the data passed.
        -- ...

1 Like

Ok so it is a dictionary, thank you very much!