I’m trying to make a donation/tip jar where If you click it then it prompts a DevProduct, which I have made a script that does that and it works but I also want it where if they purchase it then particles (confetti) comes out the top of the part. How would I do that?
I am not a scripter nor do I know how to script. The script I’ve listed below I had to watch a Youtube tutorial on how to make it.
This is the script I have so far which all it does is If they click the part that has a “ClickDector” inside of it then it prompts a DevProduct
Script
local MarketPlaceService = game:GetService("MarketplaceService")
local ClickDectector = script.Parent.ClickDetector
local DevProductId = 1187868989
ClickDectector.MouseClick:Connect(function(Player)
MarketPlaceService:PromptProductPurchase(Player, 1187868989)
end)
Use Particle Emitters.
Once you customize your emitter to look something like confetti, use the Enabled property to enable and disable it.
Example:
local MarketPlaceService = game:GetService("MarketplaceService")
local ClickDectector = script.Parent.ClickDetector
local DevProductId = 1187868989
local emitter; -- specify path
ClickDectector.MouseClick:Connect(function(Player)
MarketPlaceService:PromptProductPurchase(Player, 1187868989)
emitter.Enabled = true;
wait(5);
emitter.Enabled = false;
end)
Use coroutines or some sort of better logic to avoid the delay caused by each tip. This is as simple as it can get.
I did not include a proper handler for whether the purchase was actually successful or not but I’m sure you will figure that one out yourself.
1 Like
You need to use MarketplaceService.ProcessReceipt and Particle Emitters | Roblox Creator Documentation
local MarketplaceService = game:GetService("MarketplaceService")
local Part = workspace.Part
MarketplaceService.ProcessReceipt = function(receiptInfo)
local ProductId = receiptInfo.ProductId
if ProductId == 1187868989 then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if player then
spawn(function()
Part.ParticleEmitter.Enabled = true
wait(3)
Part.ParticleEmitter.Enabled = false
end)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end