How would one get a player's total place visits count?

Hey!

So in my game I would like to display both the account age of a player and his total place visits, just like in alexnewtron’s Wheel of Fortune when the host introduces each player one by one at the beginning. While the account age is fairly easy to get I cannot figure out how to get the latter. I have seen posts about collecting data from the source html of the website or using all sorts of apis that have nothing to do with what I’m looking for… so far I’m kind of lost.

Any ideas?

This API: https://games.roblox.com/docs

Got this from this question which is very similar to what you asked.

2 Likes

Thank you for your reply. Yes this is similar but not what I want, basically I would like to get what’s circled in red on the following screenshot.


So the total place visits of a user, not a game.

I would just post a GET request to:

https://games.roblox.com/v2/users/PLAYER_USER_ID/games?sortOrder=Asc&limit=100

then for each universe in that JSON packet, I’d perform ths operation:

https://games.roblox.com/v1/games?universeIds=UNIVERSE_ID

the last request would return you the visit count for that universe. The rest is just addition of all those values

3 Likes

This seems to be one good solution. However how would I go about doing all of this? I have seen elsewhere that you cannot use roblox APIs within a script, and so you’d have to use a proxy or even set up your own, which is quite confusing… sorry I’m new to using HttpService and APIs

As you said yourself. You need a proxy which an just be found by typing “Roblox API Proxy” in google or set up your own

1 Like

I ended up using rprxy.xyz as it seems to be the most popular proxy. Thank you!

Alright, I managed to find out how to apply Isocortex’s solution and it’s working perfectly!
Here is the code for the fellow programmers that come across this post in the future :

local httpService = game:GetService("HttpService")

local gamesUrl = "https://games.rprxy.xyz/v2/users"
local visitsUrl = "https://games.rprxy.xyz/v1/games?universeIds="

local gamesData = httpService:GetAsync(gamesUrl .. "/"..player.UserId.."/games?accessFilter=Public&sortOrder=Asc&limit=100")
gamesData = httpService:JSONDecode(gamesData)
gamesData = gamesData.data

local totalVisits = 0

for i=1,#gamesData do
	local gameId = gamesData[i].id
	local visitsData = httpService:GetAsync(visitsUrl..gameId)
	visitsData = httpService:JSONDecode(visitsData)
	visitsData = visitsData.data
	totalVisits=totalVisits+visitsData[1].visits
	wait()
end

print(totalVisits)

Problem solved!

Thank you all very much for your replies :smiley:

5 Likes