I put a regular script into the Starterpack. (Unsure if this is the problem.) I'm trying to send leaderstats NumberValue "Coins". Purchasing works, but sending the "Coins" won't. Any help on how to fix this?
local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") MarketplaceService.ProcessReceipt = function(receiptInfo) print("Testing Receipt Loaded") local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId local numberBought = ds:IncrementAsync(playerProductKey, 1) for i,v in pairs (game.Players:GetChildren()) do if v.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == 19918045 then print("Did this succeed?") lds = v:FindFirstChild("leaderstats") if lds ~= nil then cs = lds:FindFirstChild("Coins") if cs ~= nil then cs.Value = cs.Value + 100 print("Coins Sent") end end end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
The normal script should go into ServerScriptStorage or Workspace (or somewhere that it won't be cloned like it does in the Backpack)
Locked by Thewsomeguy, adark, and Articulating
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?