Hello, I'm trying to make an island you need a gamepass to access. When I test it, someone without the gamepass is allowed to pass through. Here is the code.
local Gamepass = 9281869 local Market = game:GetService('MarketplaceService') part = script.Parent game.Players.ChildAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) if Market:UserOwnsGamePassAsync(player.UserId, Gamepass)then part.CanCollide = false else part.CanCollide = true end end) end)
local id = 9281869 local part = script.Parent game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if purchased and ido == id then part.CanCollide = false end end) game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:connect(function(char) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then part.CanCollide = false end end) end)
--//Variables local id = 9281869 local part = script.Parent --//Services local market = game:GetService("MarketPlaceService") local function changeState() part.CanCollide = false end game.Players.PlayerAdded:Connect(function(plr) if market:UserOwnsGamePassAsync(plr.UserId, id) or market:PromptGamePassPurchaseFinished(plr, passId, ifPurchased) and ifPurchased and passId == id then changeState() end end)