GetProductInfo() not working?

Hello so I scan the gamepasses in my game to see what gamepasses a player owns when they join. This is the code that used to work (I have not updated my game at all so I didnt cause this error)

for i,v in pairs(GamepassIDs) do
			if MarketplaceService:UserOwnsGamePassAsync(plr.UserId,v) then
				local info = MarketplaceService:GetProductInfo(v, Enum.InfoType.GamePass)

				local bv = Instance.new("BoolValue")
				bv.Name = info["Name"]
				bv.Parent = plr.Gamepasses
			end
		end

(gamepassIds is just a table with all of the games gamepass IDs)
when running this I get the error that getproductinfo failed because HTTP 401 (unauthorized). It used to work and I touched nothing but now all of a sudden it doesnt work?

1 Like

Are HTTP requests enabled? If not, enable them.

1 Like

I think you just need to enable HTTP permissions on game settings inside studio

1 Like

You don’t need HttpService to get Product Info.

I can use GetProductInfo without it

1 Like

I double checked, its enabled.

Is Studio Access to API Services enabled?

1 Like

Yup everything except third party teleports is enabled.

This just means you are not authorized for the request. Its Likely you are trying to access something else

Both @hasoco and @ValiantWind are incorrect here, you can just GetProductInfo without the need to disabling a form of security, I made sure to test and yes, I am able to use it without HTTP requests OR API Access.

1 Like

Also, you should call a pcall() on the :GetProductInfo().

1 Like

It worked before though which is why its odd. I never updated the game prior to this issue occurring.

im gonna add a pcall and cycle through to see if its a specific ID that has this error or if its for every gamepass.

Can we see the rest of the script, or maybe the game pass Id table?

1 Like

rest of the script is just data loading stuff.
local GamepassIDs = {104881361,104881777,104882386,104882780,104883102,104883257}
thats the table.

Ok turns out it is one ID thats causing the error.
“104883102” this ID specifically but I still dont know whats causing this. This gamepass is just like every other one and its under the same game.

I tested in my rblx file, I dont seem to have this issue.

it prints all 6

  18:49:31.427   â–¶ {...}  -  Client - LocalScript:8
  18:49:31.779   â–¶ {...}  -  Client - LocalScript:8
  18:49:31.938   â–¶ {...}  -  Client - LocalScript:8
  18:49:32.152   â–¶ {...}  -  Client - LocalScript:8
  18:49:32.260   â–¶ {...}  -  Client - LocalScript:8
  18:49:32.360   â–¶ {...}  -  Client - LocalScript:8
1 Like

Just to add to the confusion. I dont have an any issues when play testing in studio. The error ONLY occurs in the actual game itself.

same thing is happening in my game aswell only thing i did recently was create a group game in my group now this is happening but my actual game is made by me not the group think roblox is confused and blocking something

1 Like

and only seems to be affecting players that are in my group but this is not even a group made game

1 Like

I am having this exact same issue.
It’s only with 3 of the 21 assets I have too.
All the exact same way.
I think it’s roblox related.
https://gyazo.com/b34f04e6ab3d54fdccb2ee0e2ca36887

2 Likes

It ended up working again for me randomly without me updating the game. This is 100% a roblox issue. Hopefully it also solves for you with time.

1 Like