Trying to get the DevProduct to change my Cash value in leaderstats in studio, the pop up works and the test purchase succeeds but I can’t get it to change the value of leaderstats…
the set up
-local script in a button-
local id = 1087430974
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
mps:PromptProductPurchase(plr, id)
end)
ServerScript
local MarketPlace = game.GetService("MarketplaceService")
local id1 = 1087430974
local id2 = 1087434852
local id3 = 1087434892
local id4 = 1087435607
local id5 = 1087435824
local id6 = 1087435918
local id7 = 1087436335
id1Reward = 100
id2Reward = 500
id3Reward = 1000
id4Reward = 2500
id5Reward = 5000
id6Reward = 10000
id7Reward = 1000000000000
MarketPlace.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == id1 then
local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + id1Reward
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == id2 then
local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + id2Reward
return Enum.ProductPurchaseDecision.PurchaseGranted
just tried it and this print is not working I think it could be that my idRewards and underlined blue because they don’t have a local Rewards =
but idk what to local them too…
if receiptInfo.ProductId == id1 then
local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + id1Reward
print("Sucess")
return Enum.ProductPurchaseDecision.PurchaseGranted
```