--Hello, I do not know what to do. --It just doesnt work.
--Its in a localscript in starterGui
local MarketplaceService = game:GetService("MarketplaceService") local PowerManId = 23355962 local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") 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 == PowerManId then -- handle purchase. In this case we are healing the player. player.Character.Humanoid.Health = 200 player.Character.Humanoid.WalkSpeed = 32 player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 3200 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
You need it in a Server Script