My goal is to teleport players whenever the countdown ends, and while there are no problems with that, there seems to be a problem regarding player spawn points. Each player is assigned a spawn point depending on what kind of index the player has in the table (the table is updated each round, it's all happening in the OnClientEvent, which in turn gets called by a loop once the countdown ends)
However, once I decided to bring someone to test the game, I couldn't help but notice that both me and tester were teleported to the same spot, the spot where player[1] should be teleported, despite the fact that there are 2 players, not 1.
As I decided to delve deeper into this problem, I reckon it's because of the IF condition that I used, but I can't exactly pinpoint the problem. This issue existed before, and I thought that adding GetChildren() function into the event would fix the problem, but it didn't. Script: (viewing the source is advised)
game.ReplicatedStorage.Wait.OnClientEvent:Connect(function()
local players = game.Players:GetPlayers()
if players[1] then
players[1].Character:MoveTo(Vector3.new(-691.75, 1.5, 2181.85))
elseif players[2] then
players[2].Character:MoveTo(Vector3.new(-733.7, 1.5, 2181.85))
elseif players[3] then
players[3].Character:MoveTo(Vector3.new(-775.45, 1.5, 2181.85))
elseif players[4] then
players[4].Character:MoveTo(Vector3.new(-421.15, 1.5, 1901.43))
elseif players[5] then
players[5].Character:MoveTo(Vector3.new(-381.6, 1.5, 1901.43))
elseif players[6] then
players[6].Character:MoveTo(Vector3.new(-322.35, 1.5, 1901.43))
elseif players[7] then
players[7].Character:MoveTo(Vector3.new(1039.78, 1.52, 1923.129))
elseif players[8] then
players[8].Character:MoveTo(Vector3.new(1039.78, 1.52, 1973.379))
elseif players[9] then
players[9].Character:MoveTo(Vector3.new(1039.78, 1.52, 2013.579))
elseif players[10] then
players[10].Character:MoveTo(Vector3.new(245.941, 1.47, 1951.26))
elseif players[11] then
players[11].Character:MoveTo(Vector3.new(289.491, 1.47, 1951.26))
elseif players[12] then
players[12].Character:MoveTo(Vector3.new(329.441, 1.47, 1951.26))
end

1 comment
The real problem is that you're using elseif statements, becuase if there's one player the other one won't be teleported too.