Does anybody know an API to check Total Player Count?

Hey I need an http that returns how many players that are in a game ID in total, so all places together, how would I do this?

I saw that but I couldn’t make it work, I changed out the Id=100 to Id= and then my game id, just an empty table.

This requires universeId rather than gameId. Try the following.

Also would really recommend cleaning this up I did this kinda poorly and in a rush.

local HTTP = game:GetService("HttpService")


local function getPlayerCountFromPlaceId(placeId)
	local succ, res = pcall(function()
		return HTTP:GetAsync("https://apis.roproxy.com/universes/v1/places/"..placeId.."/universe")
	end)

	if succ and res then
		local universeId = HTTP:JSONDecode(res)["universeId"]
		
		local succ2, res2 = pcall(function()
			return HTTP:GetAsync("https://games.roproxy.com/v1/games?universeIds="..universeId)
		end)

		if succ2 and res2 then
			return HTTP:JSONDecode(res2)["data"][1]["playing"]
		end

	end
end


local playerCount = getPlayerCountFromPlaceId(364483307)
print("Place ID has "..playerCount.." players.")
1 Like

well are you sure it works, cause it is returning 0 right now

nvm just updated slowly, thanks!

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