Round system -- Table issue [ I found a solution already ]

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
  • If player touch the winning part = he wins
  • Last player alive wins
  1. What is the issue?
  • Sometimes a player is not added to the table and it’s not teleported to the chosen map.

(This is just the code where I have the issue)

while task.wait(1) do
	if In_intermission then
		
		if not PickedMaps then
			PickedMaps = true;
			Pick_maps_to_voting();
		end
		
		if Lobby_stay > 0 then
			set_time(Lobby_stay)
			
			Lobby_stay -= 1;
			
			Pick_current_map()
			
		else
			In_intermission = false;
			
			Lobby_stay = Intermission_time;
			
			if CurrentMap then
				GameMap = CurrentMap:Clone();
				GameMap.Parent = workspace
				GameMap:SetPrimaryPartCFrame(workspace.Game_maps_position.CFrame)
				
				Clear_all_votes();
				Set_votes_on_GUI();
				
				LoadingText();
				
				for _, Pmodel in ipairs(game:GetService('Players'):GetChildren()) do
					if Pmodel.Character then
						Pmodel.Character.HumanoidRootPart.Position = GameMap.Spawn.Position + Vector3.new(0, 5, 0)
						Pmodel.Character.Humanoid.WalkSpeed = 0
					end
				end
				
				In_round = true;
				
				for i = 1, #game.Players:GetPlayers() do
					game.Players:GetPlayers()[i].PlayerGui:WaitForChild("Voting").Background.Visible = false
					game.Players:GetPlayers()[i].PlayerGui:WaitForChild("Voting").Close.Visible = false
				end
				
				for _, Player in pairs(playersInRound)do
					Player:LoadCharacter()
				end
				
				task.wait(1)
				for _, Pmodel in ipairs(game:GetService('Players'):GetChildren()) do
					if Pmodel.Character then
						Pmodel.Character.Humanoid.WalkSpeed = 30
					end
				end
				
				
				for _, Player in pairs(Players:GetChildren()) do
					table.insert(playersInRound, Player) 
					connections[Player.Name] = Player.Character.Humanoid.Died:Connect(function()
						table.remove(playersInRound, table.find(playersInRound, Player))
						if playersInRound[2] ~= nil then
						else
							End_round();
							Player.leaderstats.Wins.Value += 1
						end
					end)
				end
				
				connections["Removing"] = game.Players.PlayerRemoving:Connect(function(player) -- remove player from list if they leave
					local ind = table.find(playersInRound, player)
					if ind then
						table.remove(playersInRound, ind)
					end
				end)
					
				GameMap.FinishPart.Touched:Connect(function(Hit)
					if Hit.Parent:FindFirstChild('Humanoid') and game.Players:GetPlayerFromCharacter(Hit.Parent) then
						local plr = game.Players:GetPlayerFromCharacter(Hit.Parent)
						plr.leaderstats.Wins.Value += 1
						End_round();
					end
				end)
				
				
			end
		end
		
	elseif In_round then
		
		if Round_stay > 0 then
			set_time(Round_stay)
			
			Round_stay -= 1;
		else
			if GameMap or #playersInRound == 1 then
				End_round();
			end
		end 
	end
end 

try doing

for _, Pmodel in ipairs(game:GetService('Players'):GetChildren()) do
local Character = Pmodel.Character or Pmodel.CharacterAdded:Wait()
					if Character then
						Character.HumanoidRootPart.Position = GameMap.Spawn.Position + Vector3.new(0, 5, 0)
						Character.Humanoid.WalkSpeed = 0
					end
				end