In-Game Like Counter

Script:

local HttpService = game:GetService("HttpService")
local UniverseId = HttpService:GetAsync("http://api.roproxy.com/universes/get-universe-containing-place?placeid="..game.PlaceId)

local response = HttpService:RequestAsync({
	Url = "http://games.roproxy.com/v1/games/votes?universeIds="..UniverseId,
	Method = "GET"
})

if response.Success then
	local votes = HttpService:JSONDecode(response.Body)
	print("upVotes:", votes.data[1].upVotes)
end

Error: HttpError: InvalidRedirect
I don’t understand what the issue is.

1 Like

Please use https://apis.roproxy.com/universes/v1/places/PLACE_ID/universe instead. api.roblox.com was sunset a week ago: Sunsetting api.roblox.com on May 22, 2023

2 Likes

I keep getting the error ‘Can’t parse JSON’

You can just get the game.GameId

local UniverseId = game.GameId
1 Like

Error - “Http requests can only be executed by game server”

1 Like

You need to do it in a server script, not a local script (due to a security risk).

1 Like