Using the operator "#" in a for loop (pairs)

So currently what im doing is trying to get the players, then get the number of players by using the operator “#”. However i’m always met with the following error

ServerScriptService.RoundHandler:29: attempt to get length of a Instance value

Here’s what i’m doing

for i,v in pairs(players:GetPlayers()) do
            print(#v)
           end

how would i go about setting this up?

You have the right idea, but it’ll take a little more work to actually work.

local activePlayers = players:GetPlayers()
local numPlayers = #activePlayers

for i, v in pairs(activePlayers) do
     print(i, v)
end

All you need for the number is this:
print(#players:GetPlayers())
When you use GetPlayers() it returns a table {} of Player instances as an array.
So to loop through the instances you would:

for index, player in players:GetPlayers() do
    print("position in array:", index)
    print("player instance:", player)
end