Alr, so, I have this teleport function linking to a safe teleport module and it teleports the players successfully with all their data, just… not in the same server… How would I make them teleport to the same server, while preserving thier unique data?
local function teleportPlayers()
if #list > 0 then
teleporting = true
script.Parent.Particle.ParticleEmitter.Enabled = true
billboard.status.Text = "TELEPORTING"
billboard.status.TextColor3 = Color3.new(1,0,0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
local player = game.Players:findFirstChild(list[i])
if player then
table.insert(playersToTeleport, player)
else
table.remove(list,i)
script.Players.Value = #list
end
end
local code = TS:ReserveServer(placeId)
local options = Instance.new("TeleportOptions")
options.ReservedServerAccessCode = code
for _, player in ipairs(playersToTeleport) do
game.ReplicatedStorage.GetPlayerUnits:FireClient(player)
end
local tpData
game.ReplicatedStorage.ReturnPlayerUnits.OnServerEvent:Connect(function(plr, first, second, third, fourth, fifth)
tpData = {
Unit1 = first,
Unit2 = second,
Unit3 = third,
Unit4 = fourth,
Unit5 = fifth
}
options:SetTeleportData(tpData)
st(placeId, {plr}, options) -- hyperlinked module script
end)
repeat wait() until #list <= 0
billboard.status.Text = "READY"
billboard.status.TextColor3 = Color3.new(34/255,255/255,20/255)
teleporting = false
script.Parent.Particle.ParticleEmitter.Enabled = false
end
end