The goal I am trying to get out of this is getting all the roblox games created into a json file with the game id inside it. I know how HttpService works but I still have the issue to do this.
Thanks!
(If this is not possible i will figure out alt ways!)
You could use the https://games.roblox.com/v1/games?universeIds={UNIVERSE_ID} endpoint and just have a loop that constantly increments the universe ID and writes the output to the JSON object.
Keep in mind you will most likely be ratelimited though.
local Http = game:GetService("HttpService")
local data = {} -- data
local uid = 0 -- current universe ID
while true do
local s, e = pcall(function()
return Http:GetAsync("https://games.roblox.com/v1/games?universeIds=" .. tostring(uid))
end
if s then
local decoded = Http:JSONDecode(e)
data[uid] = decoded.data[1]
end
uid += 1
task.wait()
end
Note: You could do like ten Universe IDs at a time by separating them with commas in the query. For the sake of simplicity, I did one per request.
local Http = game:GetService("HttpService")
local data = {} -- data
local uid = 0 -- current universe ID
while true do
local s, e = pcall(function()
return Http:GetAsync("https://games.roblox.com/v1/games?universeIds=" .. tostring(uid))
end)
if s then
local decoded = Http:JSONDecode(e)
data[uid] = decoded.data[0]
end
uid += 1
task.wait(.5)
print(data[uid])
end
data[uid] prints nil or it could be that on roblox the games dont exist anymore