Without API, I already Tried to Get Visits, I have a HTTP 404 (Not Found) Error, So i need other option to get visits Code:
local function GetVisits()
local Response = httpService:RequestAsync({
Method = “GET”;
Url = string.format(“https://games.rprxy.xyz/v1/games?universeIds=%d”, game.GameId); --// Send to the rprxy.xyz proxy with the current game’s id
});
if (Response.Success and Response.Body) then --// If it succeeded, returned a status code of 200-299, and gave a Body
local Body = httpService:JSONDecode(Response.Body) --// Turn the JSON string into a Lua table
if (Body.data[1]) then --// If we got data for our game
local Visits = Body.data[1].visits;
--// Do what you need to
end
end
end
If people haven’t tried it or aren’t sure if it works then don’t respond.
Anyways here it is:
local HttpService = game:GetService("HttpService")
local function getVisits(): number
local url = `https://games.rotunnel.com/v1/games?universeIds={game.GameId}`
local success, data = pcall(HttpService.GetAsync, HttpService, url, true)
if success then
data = HttpService:JSONDecode(data)
data = data.data[1].visits or 0
return data
else
warn(data, url)
return 0
end
end
while true do
print(`Game has {getVisits()} visits`)
task.wait(60)
end
This also can be used to get the # of favorites, CCU, and more