Hello, in my testing place I have 2 gamepasses that are from the main game.
These passes in the code are checked for via a function and an if statement, and if they own the gamepass the script unlocks items.
The problem here as some testers have noted that also own the gamepass, is it will not return true even though the player actually does own the pass.
Even more oddly, it works fine for me and unlocks it for me every time.
(Also note: the pcall doesnt return any errors that i’ve seen so far)
Here is the code:
local function ownsgamepass(userid,gamepassid)
local s,res = pcall(marketPlaceService.UserOwnsGamePassAsync,marketPlaceService,userid,gamepassid)
if not s then
res = false
end
return res
end
local function checkGamepasses()
if ownsgamepass(player.UserId,16825105) then
print("OWNS GAMEPASS")
setKyloRen(true)
end
if ownsgamepass(player.UserId,17833663) then
print("OWNS GAMEPASS")
setToySkin1(true)
end
end
checkGamepasses()
local function ownsgamepass(userid, gamepassid)
local owns = false
local s, res = pcall(function()
owns = marketPlaceService:UserOwnsGamePassAsync(userid, gamepassid)
end)
if s and not res then
return owns
end
return res
end