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:
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
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.