Donation/Tip Jar. After purchase Confetti Particles come out the top

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

local MarketPlaceService = game:GetService("MarketplaceService")

local ClickDectector = script.Parent.ClickDetector

local DevProductId = 1187868989

ClickDectector.MouseClick:Connect(function(Player)

MarketPlaceService:PromptProductPurchase(Player, 1187868989)

end)

you can use

MarketPlaceService.ProcessReceipt = OnPurchase

OnPurchase would be a function inside that script that gets triggered by it.

For more info:
https://developer.roblox.com/en-us/api-reference/callback/MarketplaceService/ProcessReceipt

1 Like

I would not know how to make that work… My pet worm would be able to learn how to script before I do.

1 Like

Basically, you would first create the function with this:

local function OnPurchase(info)
--code
end

Then, we will have to do the following things:

  • Get the player and check if they are in game (Won’t be necessary in this case, so i wont include this)
  • Create confetti with a ParticleEmitter
local MarketPlaceService = game:GetService("MarketPlaceService")
local confettiid = 0

local function OnPurchased(info)
local confetti = Instance.new("ParticleEmitter") -- Creates a ParticleEmitter Instance
confetti.Texture = "rbxassetid://" .. confettid --Sets the texture of the confetti to a decal
confetti.Parent = workspace -- Set this to whereever the jar is located
wait(2) -- How long the confetti will appear
confetti:Destroy() -- Removes the confetti
end

MarketPlaceService.ProcessReceipt = OnPurchasedInfo -- Make sure the function gets triggered when the product gets sold

You can change any other properties with the confetti Instance (Like Size), all properties are here:
https://developer.roblox.com/en-us/api-reference/class/ParticleEmitter

Try not to copy and paste the script, though, through copy and pasting scripts you won’t learn scripting.

3 Likes

Alright, also… what’s a confettiid?

that would a variable which contains the decal id of confetti. Do you know how to use decals on Roblox?

How do I make particles into decals?

  1. Go on the Roblox Website

  2. Click on the “Create” tab, it’s located on the upper part of the page

  3. Go on the “Library” Tab now

  4. On the left there is a list of assets, go on “Decals”

  5. Search for whatever you want (In this case confetti)

  6. Once you found an image you like, (Make sure it’s transparent!)

  7. Now, in your URL, there is an ID. It looks like this:

roblox.com/library/ID

  1. Copy that ID and paste it into your script, where the confettiid variable is defined.

local confettiid = pasteidhere

And that’s how you can change the texture. Alternatively, you can upload your own decal.

1 Like

You need to have mousebutton1click:connect as you cant just say “mousebuttonclick” because it wont work as mouse button 2 is used to drag the camera and therefore doesnt work as a clicking keybind unless you alter the keybind settings in a script. The particles will need to be added in a function (so it can happen again of people purchase it multiple times) to where the particle emitter is enabled and the disabled on purchase. If you do a bunch of troubleshooting eventually you’ll get it.