it says that " – Set the callback; this can only be done once by one script on the server!"
Does that mean I must have that line under my script for the purchase to be granted? (I have another developer product (not in the same script) without that line and it works fine, does that mean the script granted the user stuff but did not fully complete the purchase?)
Since it says this can only be done once by one script, does that mean only one script can be running this line at one time, or that only one script can have this line in the server?
Apologies if the answer is something obvious, it’s just i want to make sure my players are granted their item/s and the purchase is successful, but i’m not sure where something went wrong. (or didn’t)
You’d need to assign this callback to a function in order to run code when ever a player purchases a product in your game, and then you can run logic to determine what bonus to grant to the player.
An example of setting up your callback:
function onProductPurchase(receiptInfo)
print"somebody is attempting to buy a devproduct!"
end
game:GetService("MarketplaceService").ProcessReceipt = onProductPurchase
It’s a callback, and callbacks can be set only once. (I think?)
And obviously you can only use this callback on the server, so ideally you handle this with a script in ServerScriptService.
Hi, thank you for the help. I had some issues before where purchasing one developer product would give the player the item of another developer product, I just changed the name of the function and it solved the issue.
Anyhow, this explanation helped a lot, thanks again!