I need help looping through the players list

I am very bad with for i,v in pairs, so I will need help with something kind of simple. I have the list of players on a table called “Players” but I want to make a different table of players that have a Bool value checked off called queued that is in their player scripts.

you could use:

local Players = game:GetService("Players")
local Plrs = {}

for _, Plr in pairs(Players:GetPlayers()) do
    if Plr.Bool.Value == false then
        table.insert(Plrs, Plr.UserId)
    end
end

I dont actually know if the server can read PlayerScripts but for this example, I’ll say it can

This is pretty easy to do, just run through the player list, while having a second table to add items to.

local playersWithCheckedBoolValue = {}

for _, player in ipairs(Players:GetPlayers()) do
  if player.PlayerScripts.BoolValue.Value then
    table.insert(playersWithCheckedBoolValue, player)
  end
end

And to explain for x in iter do, what ipairs does (and in extension, pairs), the table that is passed into ipairs will be iterated over and can be read using it’s key-value pair (i, v)

local list = {1,2,3,4,5}

for _, v in ipairs(list) do
  print(v)
  
end --> 1 2 3 4 5

It is is a server script and so it can’t look inside player scripts.

why would u put the bool value at player scripts?

where else could I put it, it seemed like the best option.

U can create a folder at the player instance or just leave the bool value at the player instance

Parent it to the player instance itself, that way you don’t need to index each player’s “PlayerScripts” folder for the BoolValue instance.