Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i detect how many player left in the server?

Asked by 4 years ago

Can somebody help me? I need a script that tell how many player is left in server

0
print(#game.Players:GetChildren()) greatneil80 2647 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

you can do this, it will update every time someone leaves/joins:

game.Players.PlayerAdded:Connect(function()
    local players = game.Players:GetPlayers()

    print(#players)
end)

game.Players.PlayerRemoving:Connect(function()
    local players = game.Players:GetPlayers()

    print(#players)
end)
Ad

Answer this question