So I'm confused because i did everything the roblox wiki told me to do in this script but it still doesn't work. Can anyone tell me why? Thanks if you did!
Script:
local plr = script.Parent.Parent.Parent.Parent local MarketplaceService = game:GetService("MarketplaceService") local cashid = 22957008 local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") function addcash() if plr then local leaderstats = plr:FindFirstChild("leaderstats") if leaderstats then local cash = leaderstats:FindFirstChild("Cash") if cash then cash.Value = cash.Value + 10000 end end end end script.Parent.MouseButton1Click:connect(function() MarketplaceService.ProcessReceipt = function(receiptInfo) local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId if PurchaseHistory:GetAsync(playerProductKey) then return Enum.ProductPurchaseDecision.PurchaseGranted --We already granted it. end -- find the player based on the PlayerId in receiptInfo for i, player in ipairs(game.Players:GetPlayers()) do if player.userId == receiptInfo.PlayerId then -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product) if receiptInfo.ProductId == cashid then addcash() end end end -- record the transaction in a Data Store PurchaseHistory:SetAsync(playerProductKey, true) -- tell ROBLOX that we have successfully handled the transaction (required) return Enum.ProductPurchaseDecision.PurchaseGranted end end)