trying to make something including a place’s stats. is there a way i could do that?
this should work
local GetVisits = function()
local Response = game:GetService("HttpService"):RequestAsync({Method = "GET", Url = ("https://games.roproxy.com/v1/games?universeIds="..tostring(game.GameId))})
if (Response) and (Response.Success) then
local Data = game:GetService("HttpService"):JSONDecode(Response.Body)
return Data.data[1].visits
end
end
print(GetVisits())
I wouldn’t reccomend roproxy, you can use the roblox apis for that.
You can’t use HttpService with roblox APIs, that’s why it’s called roproxy
i tried this but i just get nil. there’s jus no data from the api. like for example why is this empty?
https://games.roblox.com/v1/games?universeIds=16953799253
Are you sure you’re using the UniverseId and not the PlaceId? those two are very different things, and the URL for the place on the roblox site uses the PlaceId for the main place of a game.
i fixed it.
idk how but i got it working and it turned out pretty cool.
its a concept for one of those cringey RNG games i dont think im going to continue it tho
code turned out pretty cool tho
script.Parent.MouseButton1Click:Connect(function()
local ID = math.random(0, 2147483647)
local visits
local IsExist = false
local GetVisits = function()
while(IsExist == false) do
print(ID)
local Response = game:GetService(“HttpService”):RequestAsync({Method = “GET”, Url = (“https://games.roproxy.com/v1/games?universeIds=”…tostring(ID))})
if (Response) and (Response.Success) then
local Data = game:GetService(“HttpService”):JSONDecode(Response.Body)
if Data.data[1]== nil then
print(“hai”)
ID = math.random(0, 2147483647)elseif Data.data[1].visits == 0 then --return Data.data[1].visits print("hai this is noob") ID = math.random(0, 2147483647) else IsExist = true print("what the sigma?") print(Data.data[1].visits) end end end
end
print(GetVisits())
end)