Random Game Generator will not display the amount of visits

My random game generator will not display the amount of visits in a random game, also, the code displays even banned games (this allowed some bypassed words, which isn’t good, but it is pretty rare.)

Script:

local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")

local GetInfo = function(id)
	local PlaceID = id

	local thumbnail = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..PlaceID .."&fmt=png&wd=420&ht=420"
	local surfacegui = script.Parent.Parent.Parent.SurfaceGui
	local Info = MarketplaceService:GetProductInfo(PlaceID,Enum.InfoType.Asset)
	local CreationDate = MarketplaceService:GetProductInfo(PlaceID)

	if Info.AssetTypeId == 9 then
		surfacegui.Thumbnail.Image = thumbnail
		surfacegui.PlaceName.Text = Info.Name
		surfacegui.CreationDate.Text = Info.Created
		surfacegui.LastUpdated.Text = Info.Updated
		surfacegui.Visits.Text = Info.Visits
		return PlaceID
	end
end

local function GetRandomPlace()
	local rnger = math.random(100000, 2147483647) -- you CAN'T go any higher than this or it won't work
	local success, PlaceId = pcall(function()
		return GetInfo(rnger)
	end)

	if success and PlaceId then
		script.Parent.MouseClick:Connect(function(player)
			TeleportService:Teleport(PlaceId, player)
		end)
	else
		GetRandomPlace()
	end
end

while task.wait(10) do
	GetRandomPlace()
end

GetProductInfo will not return the amount of visits a game has.

You’re going to have to use the Games API to retrieve the amount of visits it has.

1 Like

How would you be able to retreive the visits?

You could send a request to a public proxy, since Roblox will not allow you to directly send requests to their API from a script.
An example can be: https://games.roproxy.com/v1/games?universeIds=*your EXPERIENCE id goes here* (you can get it by printing game.GameId)

To send a request, you must use HttpService. You also need HTTP Requests enabled in the game settings.

For example:

local HttpService = game:GetService("HttpService")
local request = HttpService:GetAsync(HttpService:UrlEncode("https://games.roproxy.com/v1/games?universeIds=4858199299")) -- 4858199299 is my experience id

print(request)

Although, you should read this before doing so: PSA: Stop using Roblox proxies! (roproxy, rprxy.xyz, rprxy)