Issue is as said in title, I want to get the string translated back to code which can be used in the body for the request which then I can request multiple images at once instead of doing them one by one. Here is the script.
local NextCursor = "-"
local JobIdValue = "-"
local JobIdNumber = 1
local playerTokenValue = "-"
local playerTokenNumber = 1
local HttpService = game:GetService("HttpService")
local PlaceId_Servers = HttpService:RequestAsync({
Url = "https://games.roproxy.com/v1/games/" .. 8737602449 .. "/servers/0?sortOrder=2&excludeFullGames=false&limit=10",
Method = "GET",
})
local PlaceId_ServerResults = HttpService:JSONDecode(PlaceId_Servers.Body)
JobIdValue = tostring(PlaceId_ServerResults["data"][1]["id"])
playerTokenValue = tostring(PlaceId_ServerResults["data"][1]["playerTokens"][1])
local allPlayers = {}
for _, playerToken in ipairs(PlaceId_ServerResults["data"][JobIdNumber]["playerTokens"]) do
table.insert(allPlayers, {
{
["token"] = playerToken,
["type"] = "AvatarHeadShot",
["size"] = "150x150",
["requestId"] = PlaceId_ServerResults["data"][JobIdNumber]["id"]
},
})
end
local currentPlayerAmount = 1
allPlayersValues = ""
while currentPlayerAmount <= #allPlayers do -- the string that is generated for the POST RequestAsync()
allPlayersValues = allPlayersValues .. "allPlayers[" .. currentPlayerAmount .. "][1],"
print(allPlayersValues)
currentPlayerAmount = currentPlayerAmount + 1
end
local response = HttpService:RequestAsync({
Url = "https://thumbnails.roproxy.com/v1/batch/",
Method = "POST",
Headers = {
["Content-Type"] = "application/json",
},
Body = game:GetService("HttpService"):JSONEncode({
-- this is where i'm pretty stuck right now, I want to get the string translated back to code which can be used
-- in the body so I can request multiple images at once instead of doing them one by one
})
})
local result = game:GetService("HttpService"):JSONDecode(response.Body)
print(response.Body)