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