I need help with my player choosing system

Hello there!

So I have this little piece of script right here, which is supposed to choose from a folder a random player inside.

I’ve put 3 models inside the folder for testing the script( “Player1”, “Player2” and “Player3”).

Here’s a photo by any chance:
image

The problem is that when any of my test model is chosen, it prints perfectly fine.
But when it picks my character, it prints me out “nil”.

Here’s the code:

local k = math.random(1,#plrsInLobby_Folder:GetChildren())
local chosenK = plrsInLobbyTable[k]
print(chosenK,k) -- "ChosenK" it's the name/value , and "k" is the number/index.

Here’s what it prints when a test model is chosen:

image

And here’s what it prints when my character is chosen:

image


I’ve tried a lot of things trying to solve it, so I would apreciate any answer.

I hope I don’t look dumb if it’s an obvious solution for this.

Thank you!

Show how you assign plrsInLobby_Folder and plrsInLobbyTable.

Oh okay. I did not know these were necessary.

local plrsInLobbyTable = plrsInLobby_Folder:GetChildren()
----
local plrFolder = game.Workspace.Players_Folder
local plrsInLobby_Folder = plrFolder.In_Lobby

Why is plrsInLobby_Folder assigned after it is already used in the first line?