The specified game pass does not exist! Are you using the new game pass ID?

Hello, using this script:

local player = game:GetService('Players').LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")

local function ownGamepass(id)
	if MarketplaceService:UserOwnsGamePassAsync(player.UserId, id) then
		return true;
	else
		return false;
	end
end

I have an error that make no sence because I use the new ids, everything works fine, I just have this error but nothing seem to not work, here is the error:

2 Likes

What is the value that’s being passed as id?

1 Like

it’s a number, here is one of the values: 167611188

1 Like

I don’t see any problems with that one. There could be some other one that’s messing it up.

1 Like

Do I need to use a pcall? If yes, Could you help me that it return true or false?

1 Like

I don’t think your gamepass ids are supposed to give an error, that could be an issue on your side. However, a pcall would be useful, so here’s how to implement it.

Pcall returns 2 values, one of them tells you if there was an error, and the other is the value that was returned (Or an error message if there was an error).
In your case, you can use it like this:

local success, result = pcall(MarketplaceService.UserOwnsGamePassAsync, MarketplaceService, player.UserId, id)
if not success then
	warn("Couldn't properly check if the player owns a gamepass! " .. result)
	return false
end
return result
1 Like

This appears because your error hasn’t gone away. As I mentioned, it’s likely an issue with your gamepass ids and I don’t have much to say without knowing what they are.

School Trip [STORY] 🚌 - Roblox here are all the gamepasses

I haven’t found anything useful from these gamepasses. Can you send the places in your code where the function is called?

sorry, I was eating,

I have not found anything that could potentially be the cause of the error, so I’m stumped. Good luck on fixing it though.

1 Like