Hello, dev forum!
Today while working on a dev product store I couldn’t get a speed coil dev product receipt script to work. I am hoping to get this script to the point when a player purchases the speed coil dev product the player is granted the speed coil. Currently, after the purchase players are not granted the speed coil, nothing happens. Thank you so much for reading, below is the code!
local Marketplaceservice = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local speed = ReplicatedStorage:WaitForChild("SpeedCoil")
local product ID = 1232493084
local function processReceipt(receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
local char = game.Workspace:FindFirstChild(player.Name)
local SpeedcoilClone = speed:Clone()
SpeedcoilClone.Name = "Speedcoil"
SpeedcoilClone.Parent = char
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
-- Set callback
Marketplaceservice.ProcessReceipt = processReceipt()
local Marketplaceservice = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local speed = ReplicatedStorage:WaitForChild("SpeedCoil")
local product ID = 1232493084
local function processReceipt(receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
local char = game.Workspace:FindFirstChild(player.Name)
local SpeedcoilClone = speed:Clone()
SpeedcoilClone.Name = "Speedcoil"
SpeedcoilClone.Parent = player.Backpack
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
-- Set callback
Marketplaceservice.ProcessReceipt = processReceipt()
You are doing lock product Id = 1232493084 it should be local productId = 1232493084 and - you are not even using the productId meaning it doesn’t know what to sell