I need help getting the total amount of players on roblox

I want to get the total amount of players on Roblox.

I don’t know how to get the total amount of players on Roblox and I haven’t found any other useful posts.

I tried doing print(#game.Players), but it didn’t work.

2 Likes

Just do #game.Players:GetPlayers()

The “#” only gets the number of instances in a table
When you do :GetPlayers() it returns a table

2 Likes

It didn’t work all it did was print the number of players in-game. I want it to print how many players are in Roblox.

I don’t think you can do that if you could it would use http service

-- Get the Players service
local Players = game:GetService("Players")

-- Function to update the player count
local function updatePlayerCount()
    local totalPlayers = #Players:GetPlayers()
    print("Total players:", totalPlayers)
end

-- Initial update
updatePlayerCount()

-- Update the player count whenever a player joins or leaves the game
Players.PlayerAdded:Connect(updatePlayerCount)
Players.PlayerRemoving:Connect(updatePlayerCount)

This code will set the total player amount in the value totalPlayers

1 Like

I don’t need to know how many players are in my game. I need to get how many players are in Roblox.

Do you want a live count of the players?

1 Like

I want to know how many players have an account in Roblox not in my game.

What you’re asking for isn’t something you can just use with the resources studio provided you. You would need to use external Http requests to do so.

You can use one of the endpoints provided here to find the amount:

2 Likes

I meant if you wanted a live number of the accounts in roblox.

Which one of the apis would I use?

Yes, I would like a live number of accounts in roblox.

1 Like

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