local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
HundredID = 19713100
ThousandID = 19775894
TenID = 19775920
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKeyHundred = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = ds:IncrementAsync(playerProductKeyHundred, 1)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == HundredID then
lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
cs = lds:FindFirstChild("Credits")
if cs ~= nil then
cs.Value = cs.Value + 100
elseif receiptInfo.ProductId == ThousandID then
if lds ~= nil then
if cs ~= nil then
cs.Value = cs.Value + 1000
elseif receiptInfo.ProductId == TenID then
if lds ~= nil then
if cs ~= nil then
cs.Value = cs.Value + 10000
end
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end
1 comment
Hm?