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?
01 | local teleport = game.Workspace.SpecialPart 1 |
02 | mps = game:GetService( "MarketplaceService" ) |
03 |
04 | db = true |
05 | function 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 |
17 | script.Parent.Touched:connect(onTouch) |
01 | local teleport = game.Workspace.SpecialPart 1 |
02 | mps = game:GetService( "MarketplaceService" ) |
03 |
04 | db = true |
05 |
06 | function 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 |
17 | end |
18 |
19 | script.Parent.Touched:Connect(onTouch) -- connect is deprecated |
No need to add ~= nil:
1 | mps:UserOwnsGamePassAsync(player.UserId, 489762 ) |
2 |
3 | --You can use this as well: |
4 | mps:PlayerOwnsAsset(player.UserId, 489762 ) |