I’m using Node.JS since it looks easier than the other one
I’m not using Roproxy since I’m constantly requesting for the player’s data and would probably just break the system.
this is the script I wanted aws lambda to do
local modul = {}
local HTTPService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getAsync = HTTPService.GetAsync
local jsonDecode = HTTPService.JSONDecode
local clothingUrl = ""
local gamepassesUrl = ""
local gamesUrl = ""
local function getClothing(targetId, targetType, cursor, clothing)
cursor = cursor or ""
clothing = clothing or {}
local requestUrl = clothingUrl:format(targetId, targetType, cursor)
local success, result = pcall(getAsync, HTTPService, requestUrl)
if success then
if result then
local success2, result2 = pcall(jsonDecode, HTTPService, result)
if success2 then
if result2 then
for _, clothingItem in ipairs(result2.data) do
if not table.find(clothing, clothingItem.id) then
table.insert(clothing, {clothingItem.id,clothingItem.price})
end
end
cursor = result2.nextPageCursor
if cursor then
return getClothing(targetId, targetType, cursor, clothing)
else
return clothing
end
end
else
warn(result2)
task.wait(1)
return --getClothing(targetId, targetType, cursor, clothing)
end
end
else
warn(result)
print("t")
task.wait(1)
return "bruh"--getClothing(targetId, targetType, cursor, clothing)
end
end
local function getGamepassesRecursive(gameId, cursor, gamepasses)
cursor = cursor or ""
gamepasses = gamepasses or {}
local requestUrl = gamepassesUrl:format(gameId, cursor)
local success, result = pcall(getAsync, HTTPService, requestUrl)
if success then
if result then
local success2, result2 = pcall(jsonDecode, HTTPService, result)
if success2 then
if result2 then
for _, gamepassItem in ipairs(result2.data) do
if table.find(gamepasses, gamepassItem.id) == nil and gamepassItem.price ~= nil then
table.insert(gamepasses, {gamepassItem.id,gamepassItem.price})
end
end
cursor = result2.nextPageCursor
if cursor then
return getGamepassesRecursive(gameId, cursor, gamepasses)
else
return gamepasses
end
end
else
warn(result2)
task.wait(1)
return --getGamepassesRecursive(gameId, cursor, gamepasses)
end
end
else
warn(result)
print("t")
task.wait(1)
return --getGamepassesRecursive(gameId, cursor, gamepasses)
end
end
local function getGames(targetId, targetType, cursor, games)
cursor = cursor or ""
games = games or {}
local requestUrl = gamesUrl:format(targetType, targetId, cursor)
local success, result = pcall(getAsync, HTTPService, requestUrl)
if success then
if result then
local success2, result2 = pcall(jsonDecode, HTTPService, result)
if success2 then
if result2 then
for _, gameItem in ipairs(result2.data) do
table.insert(games, gameItem.id)
end
cursor = result2.nextPageCursor
if cursor then
return getGames(targetId, targetType, cursor, games)
else
return games
end
end
else
warn(result2)
task.wait(1)
return --getGames(targetId, targetType, cursor, games)
end
end
else
warn(result)
print("yes")
task.wait(1)
return nil --getGames(targetId, targetType, cursor, games)
end
end
function modul.GetProducts(userId)
local sellableAssets = {}
local userClothing = getClothing(userId, 1)
local userGames = getGames(userId, "users")
local userGamepasses = {}
if userClothing == "bruh" then
print("ta")
return "bruh",nil
end --- if error
for _, userGameId in ipairs(userGames) do
local userGameGamepasses = getGamepassesRecursive(userGameId)
for _, userGameGamepass in ipairs(userGameGamepasses) do
table.insert(userGamepasses, userGameGamepass)
end
end
for _, userClothingId in ipairs(userClothing) do
table.insert(sellableAssets, userClothingId)
end
print(sellableAssets, userGamepasses)
return sellableAssets, userGamepasses
end
return modul