How Can I Get Visits Of Game?

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

There’s already a post, check this out maybe this could help

nope, still have error - Can’t parse JSON

1 Like

Well for one, your endpoint uses the UniverseId of the place, not the placeid.

You can use this

https://apis.roblox.com/universes/v1/places/PLACEID/universe

to find the universe id. Then feed the universe id into the original endpoint you have.

Still Have Error - HttpService is not allowed to access that Roblox resource

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

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