Update 3/16/2023: This topic will teach you how to get some data from your game using a PUBLIC proxy (Hosting your own is more viable)
Points to see:
- Get the visits and the thumbnail of a game?
- Username and UserId of the creator.
- Place name and last update
Requires:
- It only works In-game, not in studio so you’d better publish it before testing
- You need to have HTTP Request enabled and access to the API
This tutorial was made especially for beginner users and to reduce the number of separate topics on this subject.
Game Visits:
Now as some know we need a proxy to be able to access, I will use “Roproxy”
To get the visits we will need to get the UniverseId.
Get UniverseId
To get the UniverseId of your game write: game.GameId
Getting the UniverseId of another game (not yours):
local HttpService = game:GetService("HttpService")
local GameId = 0000000000
local UniverseUrl = "https://apis.roproxy.com/universes/v1/places/"..GameId.."/universe"
local UniverseResponse = HttpService:RequestAsync({
Url = UniverseUrl,
Method = "GET"
});
local data = HttpService:JSONDecode(UniverseResponse.Body);
local UniverseId = data["universeId"]
With the UniverseId in our hands, we can finally see the total visits of our game
local HttpService = game:GetService("HttpService")
local UniverseId = game.GameId
local Url = "https://games.roproxy.com/v1/games?universeIds="..UniverseId
local IsSuccess, Result = pcall(function()
return HttpService:GetAsync(Url)
end)
if IsSuccess then
local data = HttpService:JSONDecode(Result)["data"][1]
local visits = data["visits"]
print("Game Visits: "..visits)
else
warn("Something went wrong!")
end
HttpService can fail sometimes so there may be cases that the script doesnt progress, to solve this, its recommended to use pcall()
Game Thumbnail:
This is much easier, you will simply place the following:
Where it says “GameId” you put the id of your game.
"https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..GameId.."&fmt=png&wd=420&ht=420"
Creator details:
For this we will need MarketplaceService:
local MarketPlaceService = game:GetService("MarketplaceService")
local info = MarketplaceService:GetProductInfo(GameId)
local CreatorId = info.Creator.CreatorTargetId
local CreatorName = info.Creator.Name
Extra:
local GameName = TheGame.Name
If you want more information: click here
Game Extra Data:
Dates
If you put something like “TheGame.Created”, it works… but its not clean
→ 2020-07-07T06:10:00.000Z
We want something like this:
→ 07-07-2020
So we create this function:
local function ConvertJsonDate(ISO8601Date)
local GameDate = ISO8601Date:sub(1, 10)
local TheDate = GameDate:split("-")
return TheDate[3].."-"..TheDate[2].."-"..TheDate[1]
end
and convert the dates:
ConvertJsonDate(TheGame.Created)
ConvertJsonDate(TheGame.Updated)
I hope this helps, especially for those trying to find random games like Super Place Roulette.
Where to find the roblox API?
Here: Roblox Docs
Conclusion:
The errors in the scripts were fixed, but dont forget that the proxy isn’t mine, so it can become deprecated at any time.
I’ve fixed this now, but I may not be able to do it in the future, so like I said before: Hosting your own is much more viable