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
9 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:

1VIPs = {}

In the end I hope to do this:

1function CheckVIPs(name)
2    for i = 1, #VIPs do
3        if VIPs[i] == name then
4            return true;
5        end
6    end
7    return false;
8end

1 answer

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

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

01local VIPs = {}
02 
03local passId = 0000000 -- change this to your game pass ID.
04 
05function isAuthenticated(player) -- checks to see if the player owns your pass
06    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
07end
08 
09game.Players.PlayerAdded:connect(function(plr)
10    if isAuthenticated(plr) then
11        table.insert(VIPs, plr)
12    end
13end)

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

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

Ad

Answer this question