Inserting player name into table

so im trying to make a fighting game custom gamemode’s
well uhh its doing fine so far but…
the player didnt get inserted to table
full script :

--// Service's //--

local plrs = game:GetService("Players")
local rep = game:GetService("ReplicatedStorage")
local ss = game:GetService("ServerStorage")
local Teams = game:GetService("Teams")

--// Settings //--

local roundSetup = {
	--IntermissionMinutes = 0,
	IntermissionSeconds = 30,
	--StartingMinutes = 0,
	StartingSeconds = 3,
	--GameMinutes = 0,
	GameSeconds = 600,
	inRound = rep.InRound,
	mapName = rep.MapName,
	timer = rep.Timer
}

--// Variables //--

local events = rep.Remotes:WaitForChild("Events")
local functions = rep.Remotes:WaitForChild("Functions")
local lobbySpawn = game.Workspace.lobbySpawn
local maps = rep.Maps:GetChildren()
local items = ss:WaitForChild("Items")
local votingSystem = game.Workspace.Voting	

local choices = votingSystem:GetChildren()

local isAnOption
local randomMap

local chosenMap
local mapClone

local bluTeamCount
local RedTeamCount

local remainingBlu
local remainingRed

local Team1 = "RED"
local Team2 = "BLU"
local bluIntel = game.ReplicatedStorage.BluIntel
local redIntel = game.ReplicatedStorage.RedIntel

local bluTeam
local redTeam

-- events
local getItemsEvent = events:WaitForChild("GetItems")
local inMenuEvent = events:WaitForChild("InMenuEvent")

--"Status's"
local status = {
	statusTimer = rep.StatusTimer,
	realStatus = rep.Status
}

local timer = {
	seconds = status.statusTimer.Seconds,
	minutes = status.statusTimer.Minutes
}

--// Main Code //--

function chosenGamemode()
	if mapClone then
		if mapClone:WaitForChild("Gamemode").Value == "Free For All" and roundSetup.inRound.Value == true then
			print("a ffa")
			for i, plr in pairs(plrs:GetChildren()) do

				local char = plr.Character
				local humanRoot = char:WaitForChild("HumanoidRootPart")

				local spawns = mapClone.Spawns:GetChildren()

				local randomSpawn = spawns[math.random(1, #spawns)]
				if char and roundSetup.inRound.Value == true and not char:WaitForChild("InMenu").Value then
					humanRoot.CFrame = randomSpawn.CFrame + Vector3.new(math.random(1,4),math.random(1,4),math.random(1,4))
					local mainMenuGui = plr.PlayerGui:WaitForChild("MainMenuGui")
					local playBtn = mainMenuGui.MainMenu.BottomFrame.Menus:WaitForChild("PlayButton")

					playBtn.MouseButton1Click:Connect(function()
						char:WaitForChild("InMenu").Value = false
						humanRoot.CFrame = randomSpawn[math.random(1, #randomSpawn)].CFrame + Vector3.new(math.random(1,4),math.random(1,4),math.random(1,4))
						getItems(plr)
					end)
				end

				plrs.PlayerAdded:Connect(function(plr)
					plr.CharacterAdded:Connect(function(char)
						if char and roundSetup.inRound.Value == true and not char:WaitForChild("InMenu").Value then
							local rootPart = char:WaitForChild("HumanoidRootPart")
							rootPart.CFrame = randomSpawn.CFrame + Vector3.new(math.random(1,4),math.random(1,4),math.random(1,4))
							local mainMenuGui = plr.PlayerGui:WaitForChild("MainMenuGui")
							local playBtn = mainMenuGui.MainMenu.BottomFrame.Menus:WaitForChild("PlayButton")

							playBtn.MouseButton1Click:Connect(function()
								char:WaitForChild("InMenu").Value = false
								rootPart.CFrame = randomSpawn[math.random(1, #randomSpawn)].CFrame + Vector3.new(math.random(1,4),math.random(1,4),math.random(1,4))
								getItems(plr)
							end)
						end
					end)
				end)
			end
			
		elseif mapClone:WaitForChild("Gamemode").Value == "Capture The Intelligence" and roundSetup.inRound.Value == true then
			print("SOMEONE HAS CAPTURED THE INTEL")
			local redSpawn = mapClone:FindFirstChild("RedSpawner")
			local bluSpawn = mapClone:FindFirstChild("BluSpawner")
				
			local redIntelClone = redIntel:Clone()
			local bluIntelClone = bluIntel:Clone()
			
			redIntelClone.PrimaryPart = redSpawn
			bluIntelClone.PrimaryPart = bluSpawn
			
			wait(1)
			
			redIntelClone:SetPrimaryPartCFrame(redSpawn.CFrame)
			bluIntelClone:SetPrimaryPartCFrame(bluSpawn.CFrame)
			
			redIntelClone.Parent = mapClone
			bluIntelClone.Parent = mapClone
				
			print("put Intels")
	
			if not Teams:FindFirstChild(Team1) then
		
				bluTeam = Instance.new("Team", Teams)
				bluTeam.Name = Team2
				bluTeam.TeamColor = BrickColor.new("Deep blue")
				bluTeam.AutoAssignable = false
					
				redTeam = Instance.new("Team", Teams)
				redTeam.Name = Team1
				redTeam.TeamColor = BrickColor.new("Bright red")
				redTeam.AutoAssignable = false
	
			end

			print("made teams")

			for i, plr in pairs(plrs:GetChildren()) do
	
				local char = plr.Character
				local humanRoot = char:WaitForChild("HumanoidRootPart")
	
				local RedSpawns = mapClone.redSpawns:GetChildren()
				local bluSpawns = mapClone.bluSpawns:GetChildren()
					
				bluTeamCount = {}
				RedTeamCount = {}
	
				-- picks a random spawn from each team
				local randomRedSpawn = RedSpawns[math.random(1,#RedSpawns)]
				local randombluSpawn = bluSpawns[math.random(1,#bluSpawns)]
	
				-- will put the current player into a team with the less amount of players
	
				if #RedTeamCount > #bluTeamCount then
	
					plr.Team = bluTeam
					-- this is so we can make the spawn location for each player more randomized
					humanRoot.CFrame = randombluSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
	
					table.insert(bluTeamCount, plr.Name)
					print(plr.Name .. " put in ".. plr.Team.Name)
	
				elseif #bluTeamCount > #RedTeamCount then

					plr.Team = redTeam
	
					humanRoot.CFrame = randomRedSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
	
					table.insert(RedTeamCount, plr.Name)
					print(plr.Name .. " put in ".. plr.Team.Name)
					-- if both teams have the same amount of players, it choses a random team using math.random
				else
					local randTeam = math.random(1,2)
					if randTeam == 1 then
						plr.Team = bluTeam
						humanRoot.CFrame = randombluSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
						table.insert(bluTeamCount, plr.Name)
						print(plr.Name .. " put in ".. plr.Team.Name)
					else
						plr.Team = redTeam
						humanRoot.CFrame = randomRedSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
					table.insert(RedTeamCount, plr.Name)
						print(plr.Name .. " put in ".. plr.Team.Name)
					end				
				end
			end	
				
		elseif mapClone:WaitForChild("Gamemode").Value == "Team Deathmatch" and roundSetup.inRound.Value == true then
			print("is a tdm")
			if not Teams:FindFirstChild(Team1) then
				bluTeam = Instance.new("Team", Teams)
				bluTeam.Name = Team2
				bluTeam.TeamColor = BrickColor.new("Deep blue")
				bluTeam.AutoAssignable = false

				redTeam = Instance.new("Team", Teams)
				redTeam.Name = Team1
				redTeam.TeamColor = BrickColor.new("Bright red")
				redTeam.AutoAssignable = false
			end
			for i, plr in pairs(plrs:GetChildren()) do
				local char = plr.Character
				local humanRoot = char:WaitForChild("HumanoidRootPart")
				
				local RedSpawns = mapClone.redSpawns:GetChildren()
				local BluSpawns = mapClone.bluSpawns:GetChildren()
					
				bluTeamCount = {}
				RedTeamCount = {}

				-- picks a random spawn from each team
				local randomRedSpawn = RedSpawns[math.random(1,#RedSpawns)]
				local randombluSpawn = BluSpawns[math.random(1,#BluSpawns)]
				-- will put the current player into a team with the less amount of players
				if #RedTeamCount > #bluTeamCount then

					plr.Team = bluTeam
					-- this is so we can make the spawn location for each player more randomized
					humanRoot.CFrame = randombluSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
					table.insert(bluTeamCount, plr.Name)
					print(plr.Name .. " put in ".. plr.Team.Name)
					
				elseif #bluTeamCount > #RedTeamCount then
					
					plr.Team = redTeam
					humanRoot.CFrame = randomRedSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
					table.insert(RedTeamCount, plr.Name)
					print(plr.Name .. " put in ".. plr.Team.Name)
						-- if both teams have the same amount of players, it choses a random team using math.random
				else
					local randTeam = math.random(1,2)
					if randTeam == 1 then
						plr.Team = bluTeam
						humanRoot.CFrame = randombluSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
						table.insert(bluTeamCount, plr.Name)
						print(plr.Name .. " put in ".. plr.Team.Name)
					else
						plr.Team = redTeam
						humanRoot.CFrame = randomRedSpawn.CFrame + Vector3.new(math.random(1,3),math.random(1,3),math.random(1,3))
						table.insert(RedTeamCount, plr.Name)
						print(plr.Name .. " put in ".. plr.Team.Name)
					end				
				end
			end
		end
	end
end

function PickRandomMap()
	local randomNumber = math.random(1, #maps)
	randomMap = maps[randomNumber]
	
	return randomMap.CanBeVoted
end

for i, choice in pairs(choices) do

	local name = choice.label.SurfaceGui.TextLabel
	local picture = choice.Image.SurfaceGui.ImageLabel

	isAnOption = PickRandomMap()

	if isAnOption.Value == true then
		repeat 
			isAnOption = PickRandomMap()
		until
		isAnOption.Value == false
		name.Text = randomMap.Name
		picture.Image = randomMap.Image.Value
		randomMap.CanBeVoted.Value = true

	else
		name.Text = randomMap.Name
		picture.Image = randomMap.Image.Value
		randomMap.CanBeVoted.Value = true		
	end					
end	

function getItems(plr)
	for i = 1, 1, 1 do
		--melee(first item slot)
		while true do
			local rng = math.random(1, #items.Melee:GetChildren())
			local rngItem = items.Melee:GetChildren()[rng]

			if not plr.Backpack:FindFirstChild(rngItem.Name) then
				rngItem:Clone().Parent = plr.Backpack
				break
			end
		end
		task.wait(0.1)
		--projectiles(second item slot)
		while true do
			local rng = math.random(1, #items.Projectiles:GetChildren())
			local rngItem = items.Projectiles:GetChildren()[rng]

			if not plr.Backpack:FindFirstChild(rngItem.Name) then
				rngItem:Clone().Parent = plr.Backpack
				break
			end
		end
		task.wait(0.1)
		--special(third item slot)
		while true do
			local rng = math.random(1, #items.Special:GetChildren())
			local rngItem = items.Special:GetChildren()[rng]
			
			if not plr.Backpack:FindFirstChild(rngItem.Name) then
				rngItem:Clone().Parent = plr.Backpack
				break
			end
		end
	end
end

function removeItems(plr, hum)
	hum:UnequipTools()
	plr.Backpack:ClearAllChildren()
end

getItemsEvent.OnServerEvent:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	if not char:WaitForChild("InMenu").Value then
		getItems(plr)
	end
end)

inMenuEvent.OnServerEvent:Connect(function(plr, value)
	local char = plr.Character or plr.CharacterAdded:Wait()
	char:WaitForChild("InMenu").Value = value
end)

roundSetup.inRound.Changed:Connect(function()
	if roundSetup.inRound.Value == true then
		for i, plr in pairs(game.Players:GetPlayers()) do
			local char = plr.Character
			local hum = char:WaitForChild("Humanoid")
			
			if not char:WaitForChild("InMenu").Value then
				getItems(plr)
			end	
		end
	else
		for i, plr in pairs(game.Players:GetPlayers()) do
			local char = plr.Character
			local hum = char:WaitForChild("Humanoid")

			removeItems(plr, hum)
			mapClone:Destroy()

			for i, map in pairs(maps) do
				map.CanBeVoted.Value = false
			end

			for i, choice in pairs(choices) do

				local name = choice.label.SurfaceGui.TextLabel
				local picture = choice.Image.SurfaceGui.ImageLabel

				isAnOption = PickRandomMap()

				if isAnOption.Value == true then
					repeat 
						isAnOption = PickRandomMap()
					until
					isAnOption.Value == false
					name.Text = randomMap.Name
					picture.Image = randomMap.Image.Value
					randomMap.CanBeVoted.Value = true

				else
					name.Text = randomMap.Name
					picture.Image = randomMap.Image.Value
					randomMap.CanBeVoted.Value = true		
				end					
			end	
		end
	end
end)
--plrs.PlayerAdded:Connect(function(plr)
--	plr.CharacterAdded:Connect(function(char)
--		local mainMenuGui = plr.PlayerGui:WaitForChild("MainMenuGui")
--		local playBtn = mainMenuGui.MainMenu.BottomFrame.Menus:WaitForChild("PlayButton")

--		playBtn.MouseButton1Click:Connect(function()
--			char:WaitForChild("InMenu").Value = false
--		end)
--	end)
--end)

-- main round system
function round()
	while true do

		-- doin intermission

		for i, plr in pairs(game.Players:GetPlayers()) do
			for i, v in pairs(plr.Backpack:GetChildren()) do
				if v then
					removeItems()
				end
			end
		end

		lobbySpawn.Neutral = true

		--timer.minutes.Value = roundSetup.IntermissionMinutes
		--timer.seconds.Value = roundSetup.IntermissionSeconds
		roundSetup.mapName.Value = "lobby_intermission"
		for i = roundSetup.IntermissionSeconds, 0, -1 do
			roundSetup.timer.Value = i
			wait(1)
		end
		--repeat
		--	if timer.seconds.Value <= 0 then
		--		timer.minutes.Value = timer.minutes.Value - 1
		--		timer.seconds.Value = 59
		--	else
		--		timer.seconds.Value = timer.seconds.Value - 1
		--	end
		--	task.wait(1)
		--until timer.seconds.Value <= 1 and timer.minutes.Value <= 0

		local Choice1Votes = #votingSystem.Choice1.button.Votes:GetChildren()
		local Choice2Votes = #votingSystem.Choice2.button.Votes:GetChildren()
		local Choice3Votes = #votingSystem.Choice3.button.Votes:GetChildren()

		if Choice1Votes >= Choice2Votes and Choice1Votes >= Choice3Votes then
			chosenMap = votingSystem.Choice1.label.SurfaceGui.TextLabel.Text
		elseif Choice2Votes >= Choice1Votes and Choice2Votes >= Choice3Votes then
			chosenMap = votingSystem.Choice2.label.SurfaceGui.TextLabel.Text
		else
			chosenMap = votingSystem.Choice3.label.SurfaceGui.TextLabel.Text
		end
		--- getting the map from the replicated storgae to the workspace

		for i, map in pairs(maps) do
			if chosenMap == map.Name then
				mapClone = map:Clone()
				mapClone.Parent = game.Workspace
			end
		end
		-- clears all the votes for next round

		for i, choice in pairs(choices) do
			choice.label.SurfaceGui.TextLabel.Text = "*insert map here*"
			choice.Image.SurfaceGui.ImageLabel.Image = "rbxasset://textures/ui/GuiImagePlaceholder.png"
			choice.button.Votes:ClearAllChildren()
			events.VoteReset:FireAllClients(choice.button)
		end

		--timer.minutes.Value = roundSetup.StartingMinutes
		--timer.seconds.Value = roundSetup.StartingSeconds
		roundSetup.mapName.Value = "lobby_starting"
		lobbySpawn.Neutral = false
		
		for i = roundSetup.StartingSeconds, 0, -1 do
			roundSetup.timer.Value = i
			wait(1)
		end
		roundSetup.inRound.Value = true-- to make it working :>
		for i = roundSetup.GameSeconds, 0, -1 do
			wait(1)
			roundSetup.timer.Value = i
			roundSetup.mapName.Value = mapClone.Name
			-- gameing
			chosenGamemode()

			bluTeamCount = {}
			RedTeamCount = {}

			if mapClone.Gamemode.Value == "Capture The Intelligence" or mapClone.Gamemode.Value == "Team Deathmatch" then
				remainingBlu = {}
				remainingRed = {}

				local blueTeam = game.Teams:FindFirstChild("BLU")
				local REEDTeam = game.Teams:FindFirstChild("RED")

				for i, plr in pairs(game.Players:GetChildren()) do
					if plr.Team == blueTeam then
						if i == roundSetup.GameSeconds then
							table.insert(bluTeamCount, plr.Name)
						end
						table.insert(remainingBlu, plr.Name)
					elseif plr.Team == REEDTeam then
						if i == roundSetup.GameSeconds then
							table.insert(RedTeamCount, plr.Name)
						end
						table.insert(remainingRed, plr.Name)
					end
				end

				wait(1)

				if #remainingBlu == 0 and #remainingRed == 0 then
					status.realStatus.Value = "STALEMATE(they all dead now)"
					wait(15)
					status.realStatus.Value = ""
					break
				elseif #remainingRed == 0 then
					status.realStatus.Value = "BLU WINS!"
					wait(15)
					status.realStatus.Value = ""
					break
				elseif #remainingBlu == 0 then
					status.realStatus.Value = "RED WINS!"
					wait(15)
					status.realStatus.Value = ""
					break
				elseif i == 0 and #remainingBlu > 0 and #remainingRed > 0 then
					status.realStatus.Value = "STALEMATE(ran out of time)"
					wait(15)
					status.realStatus.Value = ""
				end
			else-- else its ffa :D
				local playing = {}

				for i, plr in pairs(game.Players:GetChildren()) do
					if i == roundSetup.GameSeconds then
						table.insert(playing, plr.Name)
					end	
				end

				if #playing == 0 then
					status.realStatus.Value = "funny that everyone has died"
					wait(1)
					status.realStatus.Value = ""
					break
				end

				if #playing == 1 then
					status.realStatus.Value = playing[1].." WINS!"
					for i, plr in pairs(game.Players:GetChildren()) do
						--if playing[1] == plr.name then
						--	-- this is where we check who is the last player playing, u can give the 
						--	--player a win if you want:

						--	--plr.leaderstats.Wins.Value += 1
						--end
					end
					wait(15)
					status.realStatus.Value = ""
					break

				elseif i == 0 and #playing >= 1 then
					status.realStatus.Value = "ran out time, sadly"
					wait(1)
					status.realStatus.Value = ""
				end

				wait(1)
			end
		end

		--timer.minutes.Value = roundSetup.GameMinutes
		--timer.seconds.Value = roundSetup.GameSeconds
		--roundSetup.mapName.Value = mapClone.Name
		--repeat
		--	if timer.seconds.Value <= 0 then
		--		timer.minutes.Value = timer.minutes.Value - 1
		--		timer.seconds.Value = 59
		--	else
		--		timer.seconds.Value = timer.seconds.Value - 1
		--	end
		--	task.wait(1)
		--until timer.seconds.Value <= 1 and timer.minutes.Value <= 0

		lobbySpawn.Neutral = true
		roundSetup.inRound.Value = false
		-- tp to lobby
		
		for i, v in pairs(game.Teams:GetChildren()) do
			if v then
				v:Destroy()
			end
		end

		for i, plr in pairs(game.Players:GetChildren()) do
			local char = plr.Character

			if char then
				local hum = char.Humanoid
				local rootPart = char.HumanoidRootPart

				rootPart.CFrame = lobbySpawn.CFrame
			end
		end
	end
end

spawn(round)

idk how i can fix this, pls help me

nvm i just delete the if i == roundSetup.GameSeconds then part