Matchmaking keep getting error

  1. What do you want to achieve?
    so i was making a matchmaking system .
  2. What is the issue?
    i dont know if i do something wrong or not , but this script keep getting error
  3. What solutions have you tried so far?

Server Script

local TeleportBVP = {}
local TeleportPVP = {}

local BVPid = 7067639851
local PVPid = 7393883130

local TeleportService = game:GetService("TeleportService")

local RE1 = game.ReplicatedStorage.RemoteServer:WaitForChild("MatchMaking")
local RE2 = game.ReplicatedStorage.RemoteServer:WaitForChild("Transition")

RE1.OnServerEvent:Connect(function(player, value)
	if value == "BVP" then
		table.insert(TeleportBVP, player)	
	elseif value == "PVP" then
		table.insert(TeleportPVP, player)
	end
	
	if #TeleportBVP == 4 then
		
		for i, player in pairs(TeleportBVP) do -- this is where the error come from 
			RE2:FireClient(player)
			TeleportService:TeleportToPrivateServer(BVPid, TeleportBVP)
		end
		
	elseif #TeleportPVP == 5 then
		
		for i, player in pairs(TeleportBVP) do
			RE2:FireClient(player)
			TeleportService:TeleportToPrivateServer(PVPid, TeleportPVP)
		end
	end
end)

Local Script

local RE1 = game.ReplicatedStorage.RemoteServer:WaitForChild("MatchMaking")


script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Parent.ChosenMode.Value == "BVP" then
		print("Bot Vs Players Selected!")
		script.Parent.Parent.Visible = false
		script.Parent.Parent.Parent.JoinFrame.Visible = false
		script.Parent.Parent.Parent.BackButton.Visible = false
		wait()
		script.Parent.Parent.Parent.Matchmaking.LocalScript2.Disabled = false
		RE1:FireServer(script.Parent.Parent.ChosenMode.Value)
		
	elseif script.Parent.Parent.ChosenMode.Value == "DN" then
		print("Dark Night Selected!")
		script.Parent.Parent.Visible = false
		script.Parent.Parent.Parent.JoinFrame.Visible = false
		script.Parent.Parent.Parent.BackButton.Visible = false
		wait()
		script.Parent.Parent.Parent.Matchmaking.LocalScript2.Disabled = false
		RE1:FireServer(script.Parent.Parent.ChosenMode.Value)
		
	elseif script.Parent.Parent.ChosenMode.Value == "PVP" then
		print("Player Vs Players Selected!")
		script.Parent.Parent.Visible = false
		script.Parent.Parent.Parent.JoinFrame.Visible = false
		script.Parent.Parent.Parent.BackButton.Visible = false
		wait()
		script.Parent.Parent.Parent.Matchmaking.LocalScript2.Disabled = false
		RE1:FireServer(script.Parent.Parent.ChosenMode.Value)

	end
end)

what error are you getting?
that would help

it’s said something about table “nil” . It is cuz the table only have 1 player ??