I want to stop this so when you rejoin the game and you weren’t in the game for the entire time when you purchased an event, it won’t do it right when you join another server.
Script:
local MPS = game:GetService("MarketplaceService")
local function processReceipt(receiptInfo)
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if player then
if receiptInfo.ProductId == (hidden) then
(hidden)
wait(60)
elseif receiptInfo.ProductId == (hidden) then
(hidden)
wait(500)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
MPS.ProcessReceipt = processReceipt
Sorry, not really understanding you very well. Forgive me if I’ve got this wrong but:
As far as I understand, you’ve got a developer product that triggers an in-game event. You want the player to be able to fully experience this event, and if they leave the game before they can, you want to repeat this event in another server.
Is this what you’re looking for? If not, sorry that I’m confused.
Why are you waiting until the event is done to grant purchase completed? (as far as I know), it just lets the player know the purchase went through successfully, in a way
I just said (otherwise the event would last like 0 milliseconds), sorry if I worded the original post wrong, I mean’t to give the event some time to process, for example the stuff would happen and it would wait like 200 seconds and then it would finish, because you need time to experience it.
I’m not sure if that’s the best idea, you should return the PurchaseGranted enum after they’ve purchased it in order to avoid other bugs. You can trigger the event (simultaneously) and return the enum.
That’s a different error. You can’t put code under the return function. If you want the event to run after the purchase, you can look into threading with the task.spawn function or coroutines