About gamepass not owning

You can write your topic however you want, but you need to answer these questions:

  1. for the gamepass to work and for it to show as owned, as i am the creator i should already own them, but when in game it prints not owned

  2. What is the issue? Include screenshots / videos if possible!

local owns = ownsgamepass(player.UserId, gamepassId)
		if owns then
			player.Psp.Value += value*player.pZoneMulti.Value*classMult*2
			print("owns")
		else
			player.Psp.Value += value*player.pZoneMulti.Value*classMult
			print("Dosen't Own")
		end
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i’ve looked on the hub to see if their was any information about it but didn’t see any relating it

It could’ve been possible that the ownsgamepass function either returned back a empty response, or you didn’t correctly reference 1 of the ID’s

Could we see the function that checks for the Gamepass?

local function ownsgamepass(userid, gamepassId)
	local s,res = pcall(MarketPlaceService.UserOwnsGamePassAsync, MarketPlaceService, gamepassId)
	if not s then
		res = false
	end
	return res
end

This could probably be why, I honestly don’t know what you’re even doing with this but a pcall should take form in a custom function of yours

Try this:

local function ownsgamepass(UserId, GamepassID)
    local success, oops = pcall(function()
        MarketPlaceService:UserOwnsGamePassAsync(UserId, GamepassID) --You also defined it as a dot syntax, not a colon
    end)

    if success then
        res = true
    else
        res = false
        warn(oops)
    end

    return res
end

got W003: (14,3) Global ‘res’ is only used in the enclosing function ‘ownsgamepass’; consider changing it to local

Very well then

local function ownsgamepass(UserId, GamepassID)
    local res = false
    local success, oops = pcall(function()
        MarketPlaceService:UserOwnsGamePassAsync(UserId, GamepassID) --You also defined it as a dot syntax, not a colon
    end)

    if success then
        res = true
    else
        res = false
        warn(oops)
    end

    return res
end

@JackscarIitt you are confusing the API request successfully sending a response with the response itself(if the user owns the pass). Instead the function should be:

function ownsgamepass(UserId, GamepassID)
	local owned = false 
	local success, Error = pcall(function()
		owned = MarketPlaceService:UserOwnsGamePassAsync(UserId, GamepassID)
	end)
	if success then
		return owned 
	else
		warn(Error)
	end
end

thank you very much PAGO, it looks like it has worked