Why doesn't this work?
local players = script.Parent.Parent.Parent.PlayerNames:GetChildren()
local AllPlayersTeleported = false
local NumberOfPlayersTeleported = 0
for i = 1, #players do
if game.Players:FindFirstChild(players[i].Name) == nil then
NumberOfPlayersTeleported = NumberOfPlayersTeleported + 1
table.remove(players, i)
end
end
Basically this line of code:
if game.Players:FindFirstChild(players[i].Name) == nil then
Which doesn't make sense because it returns the error that it is trying to index a nil value. I thought it's supposed to index a new value right? so why does the script break instead of return a nil value?

5 comments
You forgot an end
local players = script.Parent.Parent.Parent.PlayerNames:GetChildren() what does that mean? Did you put string values in there or is it players or????
Yes i have values of names "String values"
Is this your error message? "Argument 1 missing or nil" Then this,
game.Players:FindFirstChild(nil)is happening. Do what cabbler wrote.And change the if statement to
if players[i].Name == nil then