#How can i send teleportdata for each player individually?

1 messages · Page 1 of 1 (latest)

trim siren
#
local playeradded = game.ReplicatedStorage.PlayerEnter
local playerleft = game.ReplicatedStorage.PlayerLeave
local playerlist = {}
local play = game.ReplicatedStorage.SendOff
playeradded.Event:Connect(function(playerwhoentered)
    local plr = game.Players:GetPlayerFromCharacter(playerwhoentered)
    table.insert(playerlist,plr)
end)
playerleft.OnServerEvent:Connect(function(plrwholeft)
    if table.find(playerlist,plrwholeft) then
        table.remove(playerlist,table.find(playerlist, plrwholeft))
    end
end)
play.Event:Connect(function()
    if #playerlist ~= 0 then
        print(playerlist)
        local TeleportService = game:GetService("TeleportService")
        local Players = game:GetService("Players")

        local subPlaceId = 84211439060742
        local teleportOptions = Instance.new("TeleportOptions")
        
        
        local teleportData = {
            classId = "OMGLOAD"
        }
        local playersToTeleport = playerlist
        teleportOptions:SetTeleportData(teleportData)
        TeleportService:TeleportAsync(subPlaceId, playersToTeleport,teleportOptions)

    end
    
end)

Basically I made a teleport system (to teleport an entire party) to a sub place. However, I also made a "class" system (kinda dead rails-ish) and I let every player have their own class to use. The problem here is that I'm not sure how to send teleport data for every player individually. Should I use a for i loop to loop through all the players in the party and send teleport data individually?

glacial cobalt
#

TeleportService:TeleportAsync teleports a group of players at once and applies the same TeleportOptions w/ TeleportData which then means u cant directly assign unique TeleportData to each player in a single TeleportAsyn

#

so u could eaither
teleport players individually with unique TeleportData for each player
or
send a single TeleportData table that contains class information for all players, then process it on the destination server

#

if i was u id do the 2nd option tbh

trim siren