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
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.