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))
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))
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()
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
Do you actually own the gamepass? Or did you just buy it in studio?
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
???
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:
local gamepass = "123456789"
local gamepass = 123456789
I’m using an integer.
MarketplaceService:UserOwnsGamePassAsync(player.UserId, passID)
it seems to be returning false even tho i have it.
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!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.