Vip script wont work

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 = 12178123


local gamepassOwned = false

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


if gamepassOwned == true then
	
	workspace.VIPDoor.Transparency = 0.5
	workspace.VIPDoor.CanCollide = false
end


humanoid.Touched:Connect(function(touchedPart)
	
	if gamepassOwned == true then return end
	
	
	if touchedPart == workspace.VIPDoor 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.VIPDoor.Transparency = 0.5
		workspace.VIPDoor.CanCollide = false
	end
end)

This vip script works when i am in a different place but in this specific place it doesnt work there is no error or anything and the in built roblox buy gamepass ui doesnt even show how can i fix this

That is because the gamepass is set under a different place and Third Party Sales have been disabled for your game, which is why you don’t get the purchase prompt. Make sure to enable it in Game Settings:
image

1 Like

The prompt is stil not displaying

That could be the reason. You already own the gamepass (even if you’re on Roblox Studio Play Test)
Just comment that part out and try again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.