Gamepass prompting again despite purchase?

im not sure if this is a bug or there’s something wrong with my code. this is 100% a gamepass, not a devproduct. everytime i buy the gamepass, i can prompt a gamepass purchase again and using gamepassasync returns the player not owning said gamepass


image

	MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, id, success)
		if success and id then
			local success, ProductInfo = pcall(function()
				return MarketPlaceService:GetProductInfo(id, Enum.InfoType.GamePass)
			end)
			
			if ProductInfo.Name == "hot coca" then
				gamepassmanager.coca(player)
			end
		end
		
	end)
Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)

local ownership
	for n,v in pairs(gamepassitems) do
		local success,pdata = pcall(function()
			ownership = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,v[1])
		end)
						
	if success and ownership then
		if v[2] == "item" then
		        local item = game.ReplicatedStorage.Items:FindFirstChild(n):Clone()
			item.Parent = player.Backpack
		end
	end
end
1 Like

in roblox.you cannot buy prompts again.in studio,if you have the third-party sales option then you can buy prompts all times.

1 Like

UserOwnsGamePassAsync caches the result, which means it could still return false even after a player successfully purchases a pass while in-game

Quote from the docs about this:

If you’re otherwise sure that the purchase of the pass was successful, you can proceed with rewarding the player with the pass’ benefits and destroy the purchase prompt for that player in-order to avoid issues with repurchasing

How would I deal with this caching issue?

The method doesn’t have an argument one can use to disable the caching behavior, which is why I recommended to destroy the prompt after the purchase was successful

So the only way to combat this is to basically destroy the prompt on the client side, just to confirm?

Yes, but of course only if the purchase was otherwise successful since if you destroy it and the purchase fails, the player won’t be able to reattempt a purchase

1 Like

Ok thank you. much appreciated

1 Like

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