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

VIP Section Access acts as if I don't have VIP?

Asked by 6 years ago

I'm trying to make a VIP lounge and there would be a door with a teleport, and if you don't have VIP you get teleported to a part which is a few studs away from the VIP door. Since I created the Game Pass myself, I own it. But whenever I touch the door I get teleported back even if I have the gamepass. Anyone know what happens with the script?ack even if I have the gamepass. Anyone know what happens with the script?

01local teleport = game.Workspace.SpecialPart1
02mps = game:GetService("MarketplaceService")
03 
04db = true
05function onTouch(part)
06    local humanoid = part.Parent:FindFirstChild("Humanoid")
07    local player = game.Players:GetPlayerFromCharacter(part.Parent)
08    if db == true and humanoid ~= nil and (mps:UserOwnsGamePassAsync(player.UserId, 4897628) ~= nil) then
09    db = false
10    wait(0.24)
11    part.Parent:MoveTo(teleport.Position)
12    wait(0.5)
13    db = true
14    end
15    end
16 
17script.Parent.Touched:connect(onTouch)
0
You didn't make a condition for if the player doesn't own the gamepass. Move the teleport code into an else statement for if the player doesn't own the gamepass. Pojoto 329 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
01local teleport = game.Workspace.SpecialPart1
02mps = game:GetService("MarketplaceService")
03 
04db = true
05 
06function onTouch(part)
07    local humanoid = part.Parent:FindFirstChild("Humanoid")
08    local player = game.Players:GetPlayerFromCharacter(part.Parent)
09    local HasGamePass = mps:UserOwnsGamePassAsync(player.UserId, 4897628) -- returns true if you have the gamepass
10    if db == true and humanoid ~= nil and not HasGamePass then
11        db = false
12        wait(0.24)
13        part.Parent:MoveTo(teleport.Position)
14        wait(0.5)
15        db = true
16    end
17end
18 
19script.Parent.Touched:Connect(onTouch) -- connect is deprecated
Ad
Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago

No need to add ~= nil:

1mps:UserOwnsGamePassAsync(player.UserId, 489762)
2 
3--You can use this as well:
4mps:PlayerOwnsAsset(player.UserId, 489762)

Answer this question