Player sometimes doesn't teleport to the round

Hello!
I’ve recently released a game and I’ve seen some players report an issue where they don’t teleport sometimes.

The game grabs a list of players that are gonna play by checking if the player has character and has humanoidrootpart and has AFK off.

Then, it sends the list to bindable event which teleports them to the map.

Code:

script.Parent.SetSpawns.Event:Connect(function(PlayingPlayers, Map)
	local AvailableSpawns = {}
	for _, v in pairs(Map.Spawns:GetChildren()) do
		if v:IsA("Part") then
			table.insert(AvailableSpawns, v)
		end
	end

	for _, v in pairs(PlayingPlayers) do
		if v.Character then
			local hrp = v.Character:FindFirstChild("HumanoidRootPart")
			if hrp then
				local index = math.random(1, #AvailableSpawns)
				local randomSpawn = AvailableSpawns[index]
				hrp.CFrame = randomSpawn.CFrame
				table.remove(AvailableSpawns, index)
			end
		end
	end
end)

For some reason, someone always stays in the lobby and has the knife.

What’s the script for where this parameter comes from?

You haven’t provided the player sorting function/script.

for _, v in pairs(game.Players:GetPlayers()) do
					if table.find(AFKPlayers, v) == nil and v.Character then
						if v.Character.PrimaryPart then
							table.insert(PlayingPlayers, v)
						end
					end
				end

here it is, the table.find for afk players does work normally

Well, tbh I dont see anything wrong with the above script, which makes me think tht the AFKPlayers table must be malfunctioning. Can you send me the script which handles the AFKPlayers table @WondrousNinja?

Doubt this’ll help, but to check for character you should use the following script:

local Character = Player.Character or Player.CharacterAdded:Wait()
if Character then
    -- Code here
end

Ye this could be an issue especially if the player had just spawned and the character hasn’t loaded in.

I don’t think that’s the issue because the rounds work in a while loop to grab the players that are gonna play. If he doesn’t have a character he stays in the lobby and the game doesn’t recognize him as someone in the round.

The problem is they have already have a character loaded and humanoidrootpart too but they don’t teleport.