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

How do I let players w/ higher tiered VIPs go into VIP rooms for lower tiered VIPs?

Asked by 7 years ago

I'm having trouble making a system where a player w/ a high tier VIP game pass is able to go into a room that's accessible to lower tiered VIPs.

Example: Let's say a player bought a VIP game pass that's called Mega VIP. That player who bought Mega VIP should also get access to the VIP tier below Mega VIP, called Normal VIP.

How would I let the player that bought Mega VIP also get access to Normal VIP which is a "lower tier" than Mega VIP? (Hope I didn't sound too redundant with this question.)

Here's my script: (Does not work)

01local Config = script.Parent.Configuration
02local Gamepass = Config.GamepassId.Value
03local Group = Config.GroupId.Value
04local Gamepass2 = Config.GamepassId2.Value
05local Kill = Config.KillOnTouch.Value
06 
07local Door = script.Parent.Door
08 
09Door.Transparency = 0
10Door.CanCollide = true
11 
12function AllowedIn(Player)
13    if Player.userId == 0 then
14        return false
15    elseif Gamepass or Gamepass2 > 0 then
View all 61 lines...

1 answer

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

I cleaned up your code and made it a bit easier to understand with comments and general style. I changed it from more of a manual system to a bit more automatic in terms of creating the AllowedIn function.

The general way my changes work is that they check if the VIP level of a player is bigger than or equal to the level of a door. The majority of the changed code is simply setting it up, as the actual checking of the level is very simple!

01local Pass1 = 0000 -- VIP
02local Pass2 = 0000 -- Mega VIP
03local Group = 0000
04 
05local Marketplace = game:GetService("MarketplaceService")
06local PlayerLevels = {} -- easy to access table of VIP levels
07 
08game.Players.PlayerAdded:connect(function(Player) -- this function assigns the VIP level of a player
09    local Level = 0
10 
11    if Player:IsInGroup(Group) then
12        Level = 3 -- make sure the levels descend
13    elseif Marketplace:PlayerOwnsAsset(Player,Pass2) then -- do these in descending order of tier
14        Level = 2
15    elseif Marketplace:PlayerOwnsAsset(Player,Pass1) then
View all 48 lines...

Anything you don't understand? Please tell me :) Hope I could help!

~TDP

Ad

Answer this question