Hello, I've recently been trying to script something where I'm creating an area only players with a certain gamepass can access. Looking through some of my old creations, I found a functioning script that only works under the old system of gamepasses having normal IDs. If the player does not have the gamepass, it will teleport them a few blocks back. Could anyone help? Much appreciated, Gabe.
It's because of the recent GP change that requires MarketplaceService now. Try putting this script in a part/door. Take out the bottom portion if you don't want the door to kill non-gamepass holding players. You can add your teleport part of the script there if you like.
local door = script.Parent function open() door.CanCollide = false end function close() door.CanCollide = true end function get_player(part) for _, player in ipairs(game.Players:GetPlayers()) do if part:IsDescendantOf(player.Character) then return player end end end door.Touched:Connect(function(part) local player = get_player(part) local character = player.Character if not player then return end local allow = ( game:GetService('MarketplaceService'):UserOwnsGamePassAsync(player.userId, 1234567) -- Paste your game pass id here ) if allow then open() delay(4, close) else character.Humanoid.Health = 0 end end)