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.
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
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)