Help needed for dev product issue

  1. I want to achieve that when a player purchases a dev product raining parts fall out of the sky.

  2. 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.

  3. I have looked everywhere for solutions but didn’t find any.

Link to the game: Stud Place - Roblox

Script:

local cd = script.Parent.ClickDetector
cd.MouseClick:connect(function(plr)
    game:GetService("MarketplaceService"):PromptProductPurchase(plr,1184054103)
    workspace.PartSpawner.Spawning.Value = 1
    workspace.PartSpawner.Cooldown.Value = workspace.PartSpawner.DisableTime.Value
end)

You use MarketplaceService.ProcessReceipt to check if a Player has bought a Developer Product.

2 Likes

Thank you so much, but how would I be able to implement this into the script?

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
1 Like

THANK YOU SO MUCH YOU SAVED MY LIFE ILY <3

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.