So I’ve been looking for an answer for like 2 hours at this point, and everything I’ve found yet is etheir really complex or outdated, Is there any somewhat simple way to get the upvotes of a game?
There are a lot of topics on the developer forum about this, try these posts for example:
Perhaps I’m doing something wrong, but both methods return nil for me.
may I see your script? I could try to see why
First one(Works exactly the same):
function GetLikes(universeId)
local HttpService = game:GetService("HttpService")
local UniverseId = 6301542900
local response = HttpService:RequestAsync({
Url = "https://games.roproxy.com/v1/games/votes?universeIds="..UniverseId,
Method = "GET"
})
if response.Success then
return HttpService:JSONDecode(response.Body)
else
return 0
end
end
Second method:
local HttpService = game:GetService("HttpService")
local universeId = 6654970943
local url = "https://games.roblox.com/v1/games/votes?universeIds=" .. universeId
function GetLikes(universeId)
local success, response = pcall(function()
return HttpService:GetAsync(url)
end)
if success then
local data = HttpService:JSONDecode(response)
return data.data[1] and data.data[1].upVotes
else
return 0
end
end
Yeah they’re enabled. I already went through that mistake
the error seems to be coming from this line
My suggestion is to try to use a proxy
I’m sorry if I’m asking for too much, but, How would I do that? I haven’t really gotten into using httpService
well, I havent really worked much with http stuff, however I know there are plenty of resources to figure out how to use them.
I don’t know what a proxy is but I would put a breakpoint before that line and monitor your watch values to see where it’s going wrong. Just as a general debugging tip.
RoProxy is a proxy; you are already using a proxy provided you are using the first method. For some reason, I tried this myself, and RoProxy blocks that request. You can test this yourself in the Command Prompt:
should return correct data:
curl -L -X GET https://games.roblox.com/v1/games/votes?universeIds=YOUR_UNIVERSE_ID
sends back the HTML structure for the block message:
curl -L -X GET https://games.roproxy.com/v1/games/votes?universeIds=YOUR_UNIVERSE_ID
So… my suggestion is try a different proxy.
A proxy is a different device through which traffic can be routed. This can be useful because Roblox blocks a lot of API calls when coming from a Studio client, but it doesn’t for external servers. By routing your traffic through the proxy, you’re sending your API calls from the client to a server, which then sends it to Roblox.
Client → Roblox → {error}
Client → Proxy → Roblox → {succes}
Update - I’ve found a different URL you can use, and it still uses RoProxy:
games.roproxy.com/v1/games/UNIVERSE_ID/votes
Here’s an example of how to use it:
local httpService = game:GetService("HttpService")
local universeId = game.GameId
local success, result = pcall(httpService.RequestAsync, httpService, {
Url = `https://games.roproxy.com/v1/games/{universeId}/votes`,
Method = "GET"
})
if (not success) or (response.StatusCode < 200 or response.StatusCode > 300) then
print("Something went wrong", response.StatusCode)
else
local likes = httpService:JSONDecode(result).upVotes
print("The game has "..likes.." likes.")
end
Thank you so much for your response!
I don’t think I would have found an answer without you!
Btw, I modified the code a bit to get it to work, here’s the final version for anyone who wants to use it:
local httpService = game:GetService("HttpService")
local universeId = game.GameId-- You can also paste the id from the creator dashboard
function getLikes()
local success, result = pcall(httpService.RequestAsync, httpService, {
Url = `https://games.roproxy.com/v1/games/{universeId}/votes`,
Method = "GET"
})
if (not success) or (result.StatusCode < 200 or result.StatusCode > 300) then
print("Something went wrong", result.StatusCode)
else
return httpService:JSONDecode(result.Body).upVotes -- Works the exat same for "downVotes"
end
end