I want to achieve that when a player purchases a dev product raining parts fall out of the sky.
I already have a script for the raining parts but the issue is that i don’t know how to activate the raining script when a player buys the dev product.
I have looked everywhere for solutions but didn’t find any.
In a server script, you want to do something like this:
local Players = game:GetService("Players")
local marketplaceService = game:GetService("MarketplaceService")
local productId = 1184054103
marketplaceService.ProcessReceipt = function(receipt)
local player = Players:GetPlayerByUserId(receipt.PlayerId)
if not player then return Enum.ProductPurchaseDecision.NotProcessedYet end --// DO NOT REMOVE THIS LINE! THIS IS IMPORTANT!
if receipt.ProductId == productId then
if player then
--// Put all of the code you want to do upon the purchase here
return Enum.ProductPurchaseDecision.PurchaseGranted --// DO NOT REMOVE THIS LINE! THIS IS IMPORTANT!
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end