Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you fix this script for me?

local DataStoreService=game:GetService("DataStoreService") local PurchaseHistory = DataStoreService:GetDataStore("PurchaseHistory") local MPS=game:getService("MarketplaceService") local GravCoil=game.Lighting:WaitForChild("Gravity Coil")

MPS.ProcessReceipt = function(receiptInfo) print("processing") 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 print("still processing") for i, player in ipairs(game.Players:GetPlayers()) do print(player.Name) if player.userId == receiptInfo.PlayerId then print(player.Name.." bought it") -- 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 == 21002366 then print("Right id") GravCoil:Clone().Parent = player.Backpack 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

1 answer

No, we cannot fix this script for you because scripting helpers isn't a request site. Also, the code isn't readable as it isn't in a code block. It would be better to ask something that is related to your code and posting an output. You can't just ask people to fix stuff for you as you won't learn how to do it yourself.

This discussion is preserved as it was. New answers, comments, and votes are closed.