Hmm, i cannot find any loop...
Can you see what's wrong?
Client script:
local productId = 86797326
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer,
productId)
end)
----------------------------------------------------------------------------
server script:
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 86797326
game.Players.PlayerAdded:connect(function()
print("start")
local DeveloperProducts = game:GetService("MarketplaceService"):GetDeveloperProductsAsync():GetCurrentPage()
for _, DevProductContainer in pairs(DeveloperProducts) do
for Field, Value in pairs(DevProductContainer) do
print(Field .. ": " .. Value)
end
print(" ")
end
print("end")
end)
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == productId then
local amount = player.leaderstats.Cash.Value + 10000
############################# = ############################# + 10000
wait(1)
if player.leaderstats.Cash.Value >= amount then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end
end
|