My game has a feature where you can buy in-game items from other players via their gamepasses, like pls donate. However there is an extremely common and ongoing bug where users will receive an error looking like this:
They do get charged and they do not get the item in-game. (In technical terms, PromptGamePassPurchaseFinished is returning false for the wasPurchased parameter.) This bug has resulted in hundreds of thousands of Robux lost. We are getting hundreds of tickets within our Discord server and it sucks because we can’t do anything about it.
This is what I’m doing to manage the prompting of the gamepass:
MarketplaceService:PromptGamePassPurchase(player, listing.gamepassId)
local _connection
_connection = MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(_p, _gpid, _purchased)
if (_p ~= player) then return end
if (_gpid ~= listing.gamepassId) then
MarketplaceService:PromptGamePassPurchase(player, listing.gamepassId)
return
end
purchased = _purchased
_connection:Disconnect()
end)
I’m almost certain it’s nothing to do with my code as it works flawlessly 9/10 times, the 1 time being this error.
When this bug started occuring, we advised players to contact Roblox support, however they told players to contact us - however this isn’t our fault and we can’t do anything about this.
Please can someone help? I don’t know what to do.
Yeah that definitely sounds like a bug. Did it start happening suddenly too?
Just FYI, I don’t think you should call PromptGamePassPurchase again here. The only case where _pgid isn’t listing.gamepassId is when a different prompt finished. In that case, you shouldn’t call again and should instead wait for the event for the proper gamepass by just returning.
If you create two prompts but only have a connection that handles one prompt, that could be causing an edge case to have issues.
What is the ordering of what’s happening? (Ex: player prompts a purchase, they press confirm, they get the message above?) Is it possible that wasPurchased is false for a different event and it got disconnected before the real event?
I would consider trying to make code that’s a little more robust just in case, especially for purchases. Instead of creating and removing connections for each time you prompt a purchase, it might be much more predictable to just have a single connection to PromptGamePassPurchaseFinished, which updates the relevant things for all gamepasses and all players. Or at least a single connection for each gamepass.
Edit: Is it possible that purchased is being set twice? For example, if one prompt has _purchased as true, then the other has _purchased as false? Should you instead do:
-- true if already true or if it was purchased
purchased = purchased or _purchased
if (_gpid ~= listing.gamepassId) then
MarketplaceService:PromptGamePassPurchase(player, listing.gamepassId)
return
end
This code will never run, it’s more there simply just as a fail-safe.
Yeah it started happening rougly around 2 weeks after we released the feature and I’ve not updated it since it released.
Literally just the player clicks the button, they get prompted to buy their gamepass, and it waits until the purchased variable has resolved before doing anything else.
While this is correct - the game never prompts gamepasses unless it’s in this scenario (buying from another user) which has it’s own checks beforehand to prevent it.
(Or from the in-game store where you buy gamepasses, but that’s a completely different section of the game and it’d make no sense in this case.)
I don’t think two prompts can display anyway, and I’m not sure what’d happen if attempted. Good luck testing
Yeah, you’re correct. If the game tries to prompt a second time it just silently fails. For example, if it prompts something then prompt again while the prompt is active, PromptGamePassPurchaseFinished doesn’t fire (and the function doesn’t signal it didn’t work).
So there’s no problem with your code: even if it tries to start another prompt, it will only do that if there isn’t an existing prompt, but the connection should only exist if there is a prompt, so creating one is fine.
I wonder if your problem is a case of this bug report:
(The post above has a video showing this happened, so it’s almost certainly a bug)
It also might have something to do with deferred events, though that’s a long shot (the bug report is from right around when deferred events were widely rolled out though).
Perhaps you could try turning off deferred events and see if that stops the problem, though it’s unlikely that will be a workaround for this bug.
This is still happening and I have no solution. It would be nice to get some input from a staff member because it is causing serious issues now, we are getting hundreds of reports about it daily and we can’t do anything about it.
This is 100% a bug, we are also getting lots of tickets from users running into this issue, I have reported this to developer relations about 3 months ago and am still waiting for them to resolve it
I too have contacted developer relations both on the devforum and emails, however I still have gotten no response. This bug has also happened to me personally in other games like Pet Simulator so it’s not exactly an uncommon bug, I hope someone comments on this soon
I poked devrel again about it, they said that they’re team is working on a new system that should fix these issues but they dont know when it will be ready.
They said that in the mean time if users run into the problem, they should make a support ticket with Roblox to get a refund.