Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gamepass ID not found? Wrong ID?

Asked by 5 years ago

I have a game that gives a tool only if a game pass is bought. By clicking this part, it detects the purchase and either rewards it or prompts the pass. The problem is, when I input the id into the script the marketplace believes it is another item off-sale from another creator! As a matter of fact, the popup is an image of a t-shirt graphic that has not been accepted by moderators. I have searched for the game pass id in the URL but it is all the same. What am I missing? Is this the wrong id? The game pass id I find from the URL is 5433658 but it will not accept it. Game pass: https://www.roblox.com/game-pass/5433658/M60 Some of my code:

local id = 5433658
local marketplaceService = game:GetService("MarketplaceService") 

Then, to identify the pass I use:

function isAuthenticated(player)
return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, id) 

end

Prompt the pass:

game:GetService("MarketplaceService"):PromptPurchase(player,id)

m60:Destroy()

Can somebody give me some tips or identify an error? Perhaps send a link on the wiki to find the actual ID? Thank you.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Issues

The reason you are getting another person's shirt asset is that you can no longer use :PlayerOwnsAsset to retrieve Gamepasses.

Instead, you have to use :UserOwnsGamePassAsync which has parameters pertaining to the player's UserId and the id of the gamepass

Revised Server Script Code

function isAuthenticated(player)
    return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id)
end
Ad

Answer this question