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?
local teleport = game.Workspace.SpecialPart1 mps = game:GetService("MarketplaceService") db = true function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(part.Parent) if db == true and humanoid ~= nil and (mps:UserOwnsGamePassAsync(player.UserId, 4897628) ~= nil) then db = false wait(0.24) part.Parent:MoveTo(teleport.Position) wait(0.5) db = true end end script.Parent.Touched:connect(onTouch)
local teleport = game.Workspace.SpecialPart1 mps = game:GetService("MarketplaceService") db = true function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(part.Parent) local HasGamePass = mps:UserOwnsGamePassAsync(player.UserId, 4897628) -- returns true if you have the gamepass if db == true and humanoid ~= nil and not HasGamePass then db = false wait(0.24) part.Parent:MoveTo(teleport.Position) wait(0.5) db = true end end script.Parent.Touched:Connect(onTouch) -- connect is deprecated
No need to add ~= nil:
mps:UserOwnsGamePassAsync(player.UserId, 489762) --You can use this as well: mps:PlayerOwnsAsset(player.UserId, 489762)