Player:UserOwnsAsset is Defective on Game ID

I recently released a Paid Access Beta version of my game to a free full access, but those who bought the game in its Paid Access stage are not registering as true under Player:UserOwnsAsset(GameId). Does this take time to register in the data stores or do I need to create a workaround? As you can imagine, this is a time-sensitive issue.

3 Likes

Two things: it’s PlayerOwnsAsset, not UserOwnsAsset and you need to be using the place id, not the game id. Paid access is relative to a place not a game.

1 Like

Turns out I was using PlayerOwnsAsset, sorry I errored in the post. After viewing the Game Explorer in Studio, I am using that Place Id already.

How are you currently calling the function and in what circumstances? As places fall under the assets id system (but are given a separate named directory), the only other thing I can think of is that you are unauthorised to check the current player’s inventory.

Remember to always wrap web-bound calls in pcall in case of error. Given that players are now able to set their inventory to private, for privacy concerns and respecting the user’s choice, PlayerOwnsAsset will fail or return a falsy for private inventories.

local success, result = pcall(function ()
    return MarketplaceService:PlayerOwnsAsset(player, game.PlaceId)
end)

warn("Check for paid access purchase on", player)
warn("\t", success .. ":", result)

This is normally why a badge is given over directly checking for place asset ownership. Badges cannot be hidden along with inventories so you can check them at free will.