Hey Roblox devs. I have a teleport system in my game and I was adding player data for when the player teleports, but I came across a problem.
local function teleportPlayers()
if #list > 0 then
billboard.Frame.Status.Text = "TELEPORTING"
billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
local playersToTeleport = {}
-- This part 🡣
local TPdata = {
Coins = player.leaderstats.Coins.Value,
XP = player.leaderstats.XP.Value,
Level = player.Level.Value,
Rank = player.Rank.Value,
BlackoutLevel = player.GunLevels.BlackoutLevel.Value,
MP7Level = player.GunLevels.MP7Level.Value,
campaignLevel = player.campaignLevel.Value,
CurrentObjective = player.CurrentObjective.Value,
}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
teleporting = true
TS:TeleportToPrivateServer(placeId, code, playersToTeleport, nil, TPdata)
repeat wait() until #list <= 0
billboard.Frame.Status.Text = "READY"
billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
teleporting = false
end
end
this is the function that is supposed to teleport the player to another place, if there are players in the teleport zone. This function is kept in a while loop, so I won’t be able to add any built in functions or parameters without changing the entire thing, which I don’t have the time or patience for. The problem is, where you see the variable “Tpdata”, “player” is not being defined anywhere, and I don’t know how to define it.
Is there any simple way of getting the player, or should I have to change a lot of my scipt? If I would have to add some parameters then feel free to let me know, I can show my full script if its needed.