Create a script, not a local script, regular script. Put it in Workspace or ServerScriptService.
Create a NumberValue and put it in the script. Now write this in the script
game.Players.PlayerAdded:Connect(function(Player)
local PlayerCount = script:WaitForChild("NumberValue")
PlayerCount.Value = PlayerCount.Value + 1
end)
game.Players.PlayerRemoving:Connect(function(Player)
local PlayerCount = script:WaitForChild("NumberValue")
PlayerCount.Value = PlayerCount.Value - 1
end)
So basically the value of the NumberValue is the amount of Players in the server at all times. You're welcome.
1 comment
#game:GetService("Players"):GetChildren() seems to be what you require? You might want to filter for things that are definitely players with :IsA("Player"). However, not 100% what the question is asking. What do you mean "Player value in workpace"?