How To Transform A Table Of Players Into A Value

Hi, I need to find out how to transform a table of Players into a Value, but in a very specific way:
There’s 4 Players
I get the table of Players
(Problem) I convert it into a Value (number, in this case 4)
Do other stuff I need

Now, the thing is that I can’t have a random Value, but the Value needs to be the number of Players in the Server, I don’t need a full Script, I only need a vision of how to do that (if you want you can give me a snippet of code)
Thanks in advance!

local FakePlayers:NumberValue? = ServerStorage.Storage.NumberOfPlayers
local PlayersReal = #Players:GetPlayers() -- Number of players
FakePlayers.Value  = PlayersReal 

Like this?

3 Likes

From what I know

Players:GetPlayers()

Returns a table with the names, not a value, that’s the problem

Yeah but that table of names is converted to a number.
image

Oh wait, the # converts it into a number?
Oh my good, I feel so dumb, I’ll try that and mark ghat as the solution if it works

It worked! Thanks for your help, it was so easy in the end :sweat_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.