Why should you use HttpService? What can you do with it and is it useful?

How can you use Httpservice and what is it’s limitations? I have a game in mind, but it requires the roblox website. Are you able to use Httpservice to get a game for example adopt me with the thumbnail, player counts, like ratios, etc. or is that not possible? I couldn’t find much about Httpservice and it’s the closest to what I believe can help me make the game I have in mind, but I’m not sure how.

3 Likes

Actually, roblox prefers that you use this service to get data from other websites since it blocks access to its own site.

For everything you are asking for, I made a tutorial using Roproxy but I recommend that you use your own proxy, just in case.

You only have 500 HTTP requests per minute, keep that in mind

5 Likes

Thanks! I’ll check it out and see if it works and fits the game

1 Like

Is it possible, for example making a script that prints the top 10 most liked games on roblox or is that also not possible without getting the universal-id manually?

1 Like

I can’t think of a way, you can do it manually or maybe you can find a website that does have them.

2 Likes

Oh that sucks to hear, because the idea I have in mind requires getting multiple games at once. But I don’t know how to do it since roblox blocks httpservice working on their website sadly (I also tried). Thanks for helping though :smiley:

1 Like

If you’re trying to get a game’s info (I’m assuming from what you said), you can use MarketplaceService:GetProductInfo() for this.

local MarketplaceService = game:GetService('MarketplaceService')
local placeId = game.PlaceId

local success, info = pcall(function()
    return MarketplaceService:GetProductInfo(placeId,Enum.InfoType.Asset)
end)
if success then
   print(info)
end
1 Like

Thanks! I actually needed this, but it still doesn’t help me make a script that gets random games or top 10 most liked games. I’m trying to make a game that shows several roblox games and you can scroll through them. But still thank you!

Unfortunately, for that you would need several HTTP requests. As @mari230899 said, only 500 HTTP requests can be made per minute. As there are over 2 billion games on ROBLOX, it would take about 2778.78 days to therefore get all of the games on ROBLOX and then calculate the most liked games.

I forgot to mention there is no endpoint that gets all of the games in ROBLOX at once.

Oh I know, I was planning on making it check if it has some amount of visitors and or likes. And all games won’t load at the same time, it will slowly load in a small amount while the player scrolls through it, and if the httpservice somehow reached it’s capacity that fast, then it’ll wait for some amount of time till being able to search for more games again.

I managed to make a very simplified version

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

local GameId = math.random(1,99999)

local ImageLabel = script.Parent
local TextLabel = ImageLabel.TextLabel

local MarketPlaceService = game:GetService("MarketplaceService")
local info = MarketplaceService:GetProductInfo(GameId)

local Url = "https://games.roproxy.com/v1/games?universeIds=".. GameId
local IsSuccess, Result = pcall(function()
	return HttpService:GetAsync(Url)
end)

if IsSuccess then
	local data = HttpService:JSONDecode(Result)["data"][1]
	local visits = data["visits"]
	TextLabel.Text = "Game Visits: ".. visits .. "; Creator's Username: ".. info.Creator.Name .."; Creator's ID: ".. tostring(info.Creator.Id)
	ImageLabel.Image = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..GameId.."&fmt=png&wd=420&ht=420"
else
	warn("Something went wrong!")
end

print(info)