Script to get players gamepasses don't work

Hi there!
I am making a donation game with a friend but the script to get gamepasses from a player broke.

This script is a module and a server script run it. I don’t get any error messages but It don’t detect my gamepasses. (It return an empty table)

I use a print() and it say the function GetUserCreatedGamepassesRecursive(userId) run four time.

Can you help me please? I can’t finish the game until this script is fixed.

HttpService = game:GetService("HttpService")

return function(player)
	-- roblox api thing (make sure to enable http access in setting else ur shit dont work)
	local userId = player.UserId
	local baseUrl = "https://www.roproxy.com/users/inventory/list-json?assetTypeId=34&cursor=&itemsPerPage=100&pageNumber=%s&userId=%s"

	local function GetUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
		-- if parms not entered lol
		gamepasses = gamepasses or {}
		pageNumber = pageNumber or 1
		lastLength = lastLength or math.huge

		local requestUrl = baseUrl:format(pageNumber, userId) -- format url with image and page number
		local success, result = pcall(function()
			return HttpService:GetAsync(requestUrl) -- get request json file
		end)

		if success then
			if result then
				local success2, result2 = pcall(function()
					return HttpService:JSONDecode(result) -- decode json to roblox table
				end)

				if success2 then
					if result2 then
						for _, gamepass in ipairs(result2.Data.Items) do
							if gamepass.Creator.Id == userId then
								table.insert(gamepasses, gamepass.Item.AssetId) -- add to table if player made the item
							end
						end

						if result:len() ~= lastLength then -- if u need more result go to next page of items users has
							lastLength = result:len()
							pageNumber += 1
							GetUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
						end
					end
				else
					warn(result)
					GetUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength) -- run again
				end
			end
		else
			warn(result)
			GetUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
		end
		
		return gamepasses
	end

	return GetUserCreatedGamepassesRecursive(userId)
	--print(#userGamepasses)
	--for _, gamepassId in ipairs(userGamepasses) do
	--	print(gamepassId) -- easy
	--end
end

did you define http service on the other side

HTTP requests were allowed in the place

yeah, but if you didnt define http service, the script will go kablamo since the function is processed and ran on the script side not the module script

you could try putting that HttpService thing in the function

I tried but it still don’t work

whats the error?

to get it go to output

It don’t send any error messages, like if I never made any gamepasses

I tried to use a created proxy for this script so players don’t need to set their inventory visibility to everyone but it still don’t work.

The first print says “spotted%2Dspangled%2Dcockatoo%2Eglitch%2Eme” and “No url given”.

HttpService = game:GetService("HttpService")

return function(player, assetId)
	local PlayersGamepass = {}

	local Proxy = "https://spotted-spangled-cockatoo.glitch.me/?link="
	
	local UserId = player.UserId

	local Url1 = "spotted-spangled-cockatoo.glitch.me"
		
	local Encoded = HttpService:UrlEncode(Url1)
		
	local Response = HttpService:JSONDecode(HttpService:GetAsync(Proxy..Encoded))
	
	print(Encoded, Response)
	
	if Response.data then
		local Games = Response.data

		for i,v in pairs(Games) do

			local UniverseId = v.id

			local Url2 = "games.roblox.com/v1/games/"..UniverseId.."/game-passes?limit=100&sortOrder=Asc"

			local Encoded2 = HttpService:UrlEncode(Url2)
			local Response = HttpService:GetAsync(Proxy..Encoded2)

			Response = HttpService:JSONDecode(Response)

			if Response.data then
				for index,gamepass in pairs(Response.data) do
					table.insert(PlayersGamepass,v)
				end
			end

			task.wait(0.5) --rate limits
		end
	end

	print(PlayersGamepass)
end

What is wrong with my script?