I am trying to make a developer product with an implemented timer. However, Roblox says the product is still being processed because of that timer. I want them to be able to buy this product, even when the timer is not done. How could I do this?
MarketPlaceService.ProcessReceipt = function(recieptInfo)
if recieptInfo.ProductId == 1598382595 then
spinWheel(Players:GetPlayerByUserId(recieptInfo.PlayerId)); – timer being ran here, delays return and makes it lok like it’s still being prcessed.
return Enum.ProductPurchaseDecision.PurchaseGranted;
end;
end
You can just wrap the function in a coroutine.
How do I do that? I have never used coroutines before.
I am getting this error the second time I run it.
I know I am probably doing something really obvious wrong, but I kind of just guessed for the syntax based on my little prior knowledge.
code:
MarketPlaceService.ProcessReceipt = function(recieptInfo)
if recieptInfo.ProductId == 1581693787 then
local player = Players:GetPlayerByUserId(recieptInfo.PlayerId)
player.PlayerGui.MainUI.UpgradeFrame.Visible = false;
UnclaimedPlot._property_owners[player]:Upgrade(0)
return Enum.ProductPurchaseDecision.PurchaseGranted;
elseif recieptInfo.ProductId == 1581693941 then
local player = Players:GetPlayerByUserId(recieptInfo.PlayerId)
DataManager.Increment(player, "Rebirths", 1);
ReplicatedStorage.Events.RebirthEffect:FireClient(player)
player.PlayerGui.MainUI.UpgradeFrame.Visible = false;
return Enum.ProductPurchaseDecision.PurchaseGranted;
elseif recieptInfo.ProductId == 1598382595 then
coroutine.resume(coroutine.wrap(spinWheel(Players:GetPlayerByUserId(recieptInfo.PlayerId))))
return Enum.ProductPurchaseDecision.PurchaseGranted;
end;
end
Now, I put a coroutine.yield() at the end of the function and I’m getting both the already being processed aswell as the missing argument #1 (function expected).
task.spawn(spinWheel, Players:GetPlayerByUserId(recieptInfo.PlayerId))
It runs successfully the first time with no errors, but it won’t run after that.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.