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

How to check if a player own's a GamePass?

Asked by 9 years ago

I've used it before but I forgot how to do it, and I've checked the wiki (http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService) and found nothing that's useful for it, any help appreciated.

1 answer

Log in to vote
1
Answered by 9 years ago
local passId = 0000000 -- change this to your game pass ID.

function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
        print(plr.Name .. " has bought the game pass with id " .. passId)
    end
end)

Ad

Answer this question