local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")


local mps = game:GetService("MarketplaceService")

local gamepassID = 18133269


local gamepassOwned = false

pcall(function()

	gamepassOwned = mps:UserOwnsGamePassAsync(plr.UserId, gamepassID)
end)


if gamepassOwned == true then

	workspace.GamepassDoor2.Transparency = 1
	workspace.GamepassDoor2.CanCollide = false
end


humanoid.Touched:Connect(function(touchedPart)

	if gamepassOwned == true then return end


	if touchedPart == workspace.GamepassDoor2 then


		mps:PromptGamePassPurchase(plr, gamepassID)
	end
end)


mps.PromptGamePassPurchaseFinished:Connect(function(playerPurchased, purchasedID, purchaseSuccess)

	if not purchaseSuccess then return end

	if playerPurchased == plr and purchasedID == gamepassID then


		gamepassOwned = true


		workspace.GamepassDoor2.Transparency = 1
		workspace.GamepassDoor2.CanCollide = false
	end
end)

It is a localscript in starterplayerscripts