I have this system where it gives the player 15 seconds to purchase a revive and if they don’t then they can’t revive. How ever the purchasePrompt still lingers after 15 seconds meaning players could potentially waste their money…
I’ve tried returning Enum.ProductPurchaseDecision.NotProcessedYet on MarketplaceService.ProcessReceipt if the 15 seconds were passed but this didn’t help.
I don’t think you physically can. I’ve been a developer for 3 years and I’ve tried this for a timed revive system, but I don’t think you can because it’s a CoreGui. But if you can I will be interested!
A solution is to make it so when you buy it, it checks the time left. If there is time, then they can successfully revive. If they buy it, and the time is up, you save this in a data store for the next time they click the revive button (so they get their revive, but for the next round, and they aren’t prompted with it, if they had an old revive) If that makes sense? Or another solution is that you don’t worry at the time and just hope people don’t buy it. Not the preferred method, but what a lot of developers do.
After 15 seconds couldn’t you disable all core gui, then reenable it? Just a guess I am also quite interested in the answer if you do end up finding one.
I don’t think you can and that’s for a good reason. I’ll have to see in studio but you can only disable certain things. Because the CoreGui also contains the menu to leave the game which must always be available.
(Idk myself. I need to be more educated on CoreGui)
try implementing your own timer and checking the elapsed time before allowing the player to make a purchase.
example code:
local function promptPlayerToPurchase(player)
local promptId = "RevivePrompt"
local purchaseMade = false
game:GetService("MarketplaceService"):PromptProductPurchase(player, promptId)
wait(15)
if not purchaseMade then
print("Revive purchase not made. Revive functionality disabled.")
end
end
local player = game.Players.LocalPlayer
promptPlayerToPurchase(player)
I think the best thing to do is that if there isn’t yet, just add buttons to either go back to the lobby immediately or revive, which brings up the prompt.
I don’t think a Player would try and purchase the Revival last second, otherwise they pretty much had it coming.
This doesn’t solve the problem of allowing me to hide the prompt after 15 seconds, imagine the purchase is made after 15 seconds but the game is already over. They would essentially just lose their money
To anyone looking for a solution: Turns out there’s no real way to do this so i have to work around it
Also great suggestions pogcat, saving the revive for next round might work but players might get upset if they wanted the revive specifically for that round. And i don’t feel okay just leaving it as it is cause ik someone is gonna lose their money lol
I’ve decided to just make a new currency called revives and have players buy that when ever they want. Then they can use it immediately if they have any available.