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

If player has GamePass put into table?

Asked by
iFlusters 355 Moderation Voter
8 years ago

Title says most of it, if a player has a gamepass how would I put it into a table?

Sorry there's not much code but not sure what to do..

Table:

VIPs = {}

In the end I hope to do this:

function CheckVIPs(name)
    for i = 1, #VIPs do
        if VIPs[i] == name then
            return true;
        end 
    end
    return false;
end

1 answer

Log in to vote
0
Answered by
xuefei123 214 Moderation Voter
8 years ago

You need to use market place service, for this script it is very simple, basically like admin.

local VIPs = {}

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
        table.insert(VIPs, plr)
    end
end)

If you need any more help, go to this wiki page:

http://wiki.roblox.com/index.php?title=Game_pass

Ad

Answer this question