I want that when the player enters the game he is added to a table… and according to his position on the table another script will teleport him to another place in turn along with another player that is paired with him. more or less so:
local tabla = require(game.ServerScriptService.penepelao)
game.Players.PlayerAdded:Connect(Function(plr)
table.Insert(tabla,plr)
game.Players.PlayerRemoving:Connect(Function(plr)
table.Remove(tabla,table.Find(plr))
end)
end)
and other script
local tabla = require(game.ServerScriptService.penepelao)
--basically I want it to teleport the players to another place
--according to the order of the row or the place where it is
--example:
--[1] , [2] and then [3],[4]
--also eliminate the teleported player from the table so that he does not get in the way and does not have errors
I would also like to know what would happen if for some reason the list of the table is from [10] to [90]? When another player joins, would he enter as number [1]? or as [91]
In case it would enter as number [1], could you tell me a solution?
And finally I will explain more or less how I want it to be: I enter a game, I appear in the Lobby, then I want to teleport through a button to another place which is a connection to the game, then I enter another place which add in a queue to match me with another player and reserve a server for another game. so far so good but I tell you what problem I’m afraid will happen
let the player enter as number [20]
and then the list is cleaned and it reaches the number [10]
but unfortunately another player enters as number [1],
That’s possible?
I really thank you very much for answering my topic but by chance:
You don’t know how to teleport the players in order, that is:
if there are [20] then it starts from [1] with [2] then [3] goes with [4]
More or less how would you do it?
If you know about a topic, could you tell me?
I understand you but how would it be for keys? I mean, how would I do it in order knowing that there could be many? The truth is the first time I handle something like this
I mean, I think it’s like this:
I get the table two by two and when I get it and teleport the players I eliminate them and move on to the next ones.
right now I will see if it is possible if I inform you of something
a ok dale jaaja oye me e dado cuenta que es como tu dices… e incluso mejor. pero el problema lo que pasa es que no se como obtenerlos atravez de un ciclo for en orden:
local TeleportService = game:GetService("TeleportService")
local players= game:GetService("Players")
local tabla= require(game.ServerScriptService.tabla)
local valor = script.Parent.crearvalidacion.CantidadActual
local opcionesTransporte = Instance.new("TeleportOptions")
opcionesTransporte.ShouldReserveServer = true
local debounce = true
local idPlace = 11980871423
local teletrasnportar = {}
while debounce do
wait(1)
print("Intento1")
if debounce then
debounce = false
for i, jugadores in pairs(tabla) do
table.insert(teletrasnportar,)
end
end
end
para ser mas exacto es aqui:
for i, jugadores in pairs(tabla) do
table.insert(teletrasnportar,--como obtendria la parte de la tabla?)
end
quiero que recorra por orden y que agarre a los dos primeros de la lista
creo que entendi a lo que te refieres, si quieres que los jugadores se teletrasporten en orden de quien entro primero puedes hacer un While loop en vez de un For, entonces pones que hasta que no haya pasado el jugador que viene antes del actual, no se teletransporte… Creo que me explique bien
local TeleportService = game:GetService("TeleportService")
local plyrs = {}
local function TeleportTwo()
if #plyrs > 1 then
table.sort(plyrs, function(a, b) return a[2] < b[2] end)
if (plyrs[1][1] and plyrs[2][1]) then
local code = TeleportService:ReserveServer(game.PlaceId)
TeleportService:TeleportToPrivateServer(game.PlaceId, code, {plyrs[1][1], plyrs[2][1]})
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
table.insert(plyrs, {Player, tick()})
end)
game.Players.PlayerRemoving:Connect(function(Player)
for i, v in pairs(plyrs) do
if (v[1] == Player) then
table.remove(plyrs, i)
end
end
end)