UserOwnsGamepassAsync() always returns false even tho I own the gamepass

UserOwnsGamePassAsync() seems to always return false even tho I own the gamepass, don’t know how I can describe my issue more then this.

print(mkps:UserOwnsGamePassAsync(plr.UserId, gamepass))
2 Likes

The userid or the gamepass id could possibly be incorrect.

here is also a more refined version of your code if you need it :

local MarketplaceService = game:GetService("MarketplaceService")
local playerId = game.Players.LocalPlayer.UserId
local gamePassId = 

local function checkGamePassOwnership()
	local ownsGamePass = false


	local success, message = pcall(function()
		ownsGamePass = MarketplaceService:UserOwnsGamePassAsync(playerId, gamePassId)
	end)

	if success then
		print("Player owns game pass: " .. tostring(ownsGamePass))
	else
		warn(message)
	end
end

checkGamePassOwnership()
2 Likes

Hello, unfortunately I am not doing this on a localscript but on a server script (game.Players.PlayerAdded event). Should i do

if checkGamePassOwnership then

or
if checkGamePassOwnership == true but i add a return true after the “player owns gamepass” print

if checkGamePassOwneship then

could work , but just in case :

function checkGamePassOwnership(player, gamePassId)
    -- Check if the player owns the game pass
    if player:HasGamePassAsync(gamePassId) then
        print("Player owns game pass")
        return true
    else
        print("Player does not own game pass")
        return false
    end
end

-- Later in your code
if checkGamePassOwnership(player, gamePassId) == true then
    -- Do something
end
1 Like

Do you actually own the gamepass? Or did you just buy it in studio?

1 Like

All gamepasses that I create automatically gets added into my inventory.

It seems as HasGamePassAsync is no longer a thing. Or that’s what the error tells me atleast ¯_(ツ)_/¯

Could you please show us how you get your variables? Where do you get mkps plr gamepass ???

image
image

And I do not have a gamepass variable.

Are you using a string or an int for sending the game pass? It should be stored as an integer.

Eg:

  • Wrong: local gamepass = "123456789"
  • Correct: local gamepass = 123456789
1 Like

I’m using an integer.
image

1 Like
MarketplaceService:UserOwnsGamePassAsync(player.UserId, passID)

it seems to be returning false even tho i have it.
image

Try doing print(plr.UserId) and make sure that it is your id.

Can you run that command on your console? (of course with player.UserId replaced with your actual userId and the passID replaced by the actual gamepass id)

The MarketplaceService:UserOwnsGamePassAsync(player.UserId, passID), should work, you shoul confirm the userid and the passid

I have the same problem. Have you fixed it? if so, please tell me how.
Thanks!


After editing the pass, i took the id from here, assuming it was the gamepass id. (it was not) Maybe you also did that :person_shrugging:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.