Need help with player count (Answer Found)

  1. I don’t want a normal player counter with numbers, but more like this: (That will check if any player is getting added/removed)
    image
    W.i.p.

  2. The whole thing needs to work on the server, not the whole game.

This post is actually for a friend of mine, and he can’t code at all here are the things he tried:

-- Too long to insert code.
1 Like

Do you want to show the players in the server, or in the whole game?

I will edit it but it must be the server not the game.

This isn’t a good variable name, right?

The code doesn’t work for a number of reasons.

local proge = (0) would cause a syntax error. No idea why you need this variable anyways.
The while true do is redundant in the PlayerAdded loop, it will consume a lot of memory.
if p == 1 will always be false, and “NO” will be printed every 10 seconds.
The math behind UDim2.new(proge/100 doesn’t make sense. It will always be 0/100, which doesn’t give the correct size, ever.

Try this instead,

local bar = script.Parent.Parent.pp -- change the frame name...
local function updatebar()
    bar.Size = UDim2.new(#game.Players:GetPlayers() / game.Players.MaxPlayers,0,0.1,0)
end
updatebar()
game.Players.PlayerAdded:Connect(updatebar)
game.Players.PlayerRemoving:Connect(updatebar)
2 Likes

Thank you, this worked out fine, and sorry about the frame name… xD-

1 Like

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