Hello! I am currently making a queue system and I have run into an issue with TeleportData that is supposedly “nil” when trying to receive that data from the instance the player is teleporting to.
I am trying to send the table of players that are being teleported so that once inside of the other place, it can wait for all players to load in. Unfortunately, when I attempt to get that data, it returns nil.
Code here:
Place1 Teleport Code:
local playersToTeleport = {} -- Table that will contain all playerobjects
for i, v in pairs(queue:GetChildren()) do -- Adding all alive players in queue to teleportList
local plr = v.Value
local char = plr.Character
local hum = char.Humanoid
if hum.Health > 0 then
table.insert(playersToTeleport, plr)
else
v:Destroy()
end
end
local tpOptions = Instance.new("TeleportOptions")
tpOptions.ShouldReserveServer = true
local teleportData = {
TeleportedPlayers = playersToTeleport -- Setting playersToTeleport to table variable
}
tpOptions:SetTeleportData(teleportData)
teleportModule(placeIdToTeleport, playersToTeleport, tpOptions) -- This teleports all players
Place2 Recieving Code:
local plr = plrs.PlayerAdded:Wait()
teleportedPlayers = plr:GetJoinData().TeleportData.TeleportedPlayers -- Attempts to get table of players
while (not teleportedPlayers) do task.wait() end
print(teleportedPlayers[1]) -- prints nil
Any help would be appreciated!