I want to be able to get a list of a players created Gamepasses and their prices.
The issue is I haven’t a clue how to achieve this.
I know that in games like pls donate they search your public games for the Gamepasses you created, and that to me sounds like a perfectly good solution, but I don’t know how I would be able to access that.
local function getUserGamepasses(userId)
local url = "https://games.roproxy.com/v2/users/"..userId.."/games?accessFilter=2&limit=50&sortOrder=Asc"
local suc, res = pcall(function()
return HttpService:GetAsync(url)
end)
local placeIDs = {}
if suc then
if res then
res = string.split(res,"},")
for i, place in pairs(res) do
place = string.split(place,",")
for _, thing in pairs(place) do
if string.find(thing,"id") and not string.find(thing,"rootPlace") then
place = thing
place = string.gsub(place,"%a","")
place = string.gsub(place,"%p","")
table.insert(placeIDs,place)
end
end
end
end
end
local gamepasses = {}
local gamepassPrices = {}
local increment = 1
if #placeIDs > 0 then
for i, place in pairs(placeIDs) do
local url = "https://games.roproxy.com/v1/games/"..place.."/game-passes?limit=100&sortOrder=Asc"
local suc, res = pcall(function()
return HttpService:GetAsync(url)
end)
res = string.split(res,"}")
for x, gamepass in pairs(res) do
if string.find(gamepass,"id") then
local newPass = string.split(gamepass,",")
local productId = nil
local price = nil
for _, info in pairs(newPass) do
if string.find(info,"id") then
productId = info
productId = string.gsub(productId,"%a","")
productId = string.gsub(productId,"%p","")
end
if string.find(info,"price") then
price = info
price = string.gsub(price,"%a","")
price = string.gsub(price,"%p","")
end
end
if productId and price then
if not table.find(gamepassPrices,price) then
gamepasses[increment] = {
Item = {
AssetId = tonumber(productId)
};
Product = {
PriceInRobux = tonumber(price)
};
}
table.insert(gamepassPrices,price)
increment += 1
end
end
end
end
end
end
return gamepasses
end
-- Function above ^^^^
game.Players.PlayerAdded:Connect(function(player)
local gamepasses = getUserGamepasses(player.UserId)
-- Code to manage the gamepasses of a user
end)
It will work in both places, if you enable from the game settings the ability to allow HTTP requests.
Here’s a quick tutorial made by homemade powerpoint slides!
Thank you! I enabled the HTTP request but sadly still recieved an empty table when printing it but when I play the actualy game and look at the console I got this…
This is just the roblox console printing out the ACTUAL memory adress of the table, you shouldn’t worry about it.
Did you assign HttpService as game:GetService("HttpService")?
If you already did and there’s still an empty table, you should probably look up at the results of the web requests
local function getUserGamepasses(userId)
local url = "https://games.roproxy.com/v2/users/"..userId.."/games?accessFilter=2&limit=50&sortOrder=Asc"
local suc, res = pcall(function()
return HttpService:GetAsync(url)
end)
print(res) -- Printing for any errors
local placeIDs = {}
if suc then
if res then
res = string.split(res,"},")
for i, place in pairs(res) do
place = string.split(place,",")
for _, thing in pairs(place) do
if string.find(thing,"id") and not string.find(thing,"rootPlace") then
place = thing
place = string.gsub(place,"%a","")
place = string.gsub(place,"%p","")
table.insert(placeIDs,place)
end
end
end
end
end
local gamepasses = {}
local gamepassPrices = {}
local increment = 1
if #placeIDs > 0 then
for i, place in pairs(placeIDs) do
local url = "https://games.roproxy.com/v1/games/"..place.."/game-passes?limit=100&sortOrder=Asc"
local suc, res = pcall(function()
return HttpService:GetAsync(url)
end)
print(res) -- Checking if there's any error and putting it in the console
res = string.split(res,"}")
for x, gamepass in pairs(res) do
if string.find(gamepass,"id") then
local newPass = string.split(gamepass,",")
local productId = nil
local price = nil
for _, info in pairs(newPass) do
if string.find(info,"id") then
productId = info
productId = string.gsub(productId,"%a","")
productId = string.gsub(productId,"%p","")
end
if string.find(info,"price") then
price = info
price = string.gsub(price,"%a","")
price = string.gsub(price,"%p","")
end
end
if productId and price then
if not table.find(gamepassPrices,price) then
gamepasses[increment] = {
Item = {
AssetId = tonumber(productId)
};
Product = {
PriceInRobux = tonumber(price)
};
}
table.insert(gamepassPrices,price)
increment += 1
end
end
end
end
end
end
return gamepasses
end
Okay Thank you! I will do all that. I should just stop asking questions and buckle down with the great help yall have given me and Start to try to understand the problem. Thank you again! I really appreciate the help
Hello, back again to ask a question. I have been still having trouble and seeing that roproxy website does not seem to come up on my computer. I also saw some threads about roproxy not working anymore. Now this could be not true and I just havent figured it out yet. I just want to make sure that this roproxy service still works