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

Should I use PromptPurchase and PlayerOwnsAsset to see if they own a gamepass and buy one?

Asked by
vkax 85
5 years ago

Just wondering, so far the ID's and stuff are messed up like ROBLOX atm is broken, what should I use?

1 answer

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

No. PlayerOwnsAsset no longer works with game passes, due to the new game pass update. Game passes are no longer assets, in fact. They are their own category. You should be using MarketplaceService.UserOwnsGamePassAsync.

-- Script in ServerScriptService
-- example 
local MarketplaceService = game:GetService("MarketplaceService")
local id = 0000000000 --id

game:GetService("Players").PlayerAdded:Connect(function(player)
    if MarketplaceService:UserOwnsGamePassAsync(player.UserId, id) then
        -- argument is the UserId, not the player!
    else
        MarketplaceService:PromptGamePassPurchase(player, id)
    end
end)
Ad

Answer this question