Hello Guysđź‘‹,
I need Help with my Donation Board. Whenever i buy something in the CurrencyShop (“Token” Shop)
the Robux get added to the Donation Leaderboard and the Player don’t
receive their "Tokens" (The Product). There is also no Error or Warning in the Output (The Errors in the Video have nothing to do with the Board)
Here is a Video to understand the Problem:
And here are The Scripts oo The Donation Board:
local donateAmounts = {10, 20, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000}
local ids = {1323725028, 1323725426, 1323725659, 1323725660, 1323726734, 1323726735, 1323727077, 1323727076, 1323727075}
local mps = game:GetService("MarketplaceService")
local dss = game:GetService("DataStoreService")
local ods = dss:GetOrderedDataStore("Donators")
for i, amount in pairs(donateAmounts) do
local donateButton = script:WaitForChild("DonateButton"):Clone()
donateButton.Text = amount .. " Robux"
donateButton.Parent = script.Parent.DonatePart.DonateGui.DonateList
end
game.ReplicatedStorage.DonateRE.OnServerEvent:Connect(function(plr, button)
local amount = string.gsub(button.Text, " Robux", "")
local id = ids[table.find(donateAmounts, tonumber(amount))]
mps:PromptProductPurchase(plr, id)
end)
mps.ProcessReceipt = function(purchaseInfo)
local amount = mps:GetProductInfo(purchaseInfo.ProductId, Enum.InfoType.Product).PriceInRobux
local success, err = pcall(function()
local totalDonated = ods:GetAsync(purchaseInfo.PlayerId) or 0
ods:SetAsync(purchaseInfo.PlayerId, totalDonated + amount)
end)
return success and Enum.ProductPurchaseDecision.PurchaseGranted or Enum.ProductPurchaseDecision.NotProcessedYet
end
while wait(20) do
for i, child in pairs(script.Parent.LeaderboardPart.LeaderboardGui.LeaderboardList:GetChildren()) do
if child:IsA("Frame") then child:Destroy() end
end
local pages = ods:GetSortedAsync(false, 100)
local top = pages:GetCurrentPage()
for rank, data in ipairs(top) do
local username = game.Players:GetNameFromUserIdAsync(data.key)
local donated = data.value
local leaderboardFrame = script.LeaderboardFrame:Clone()
leaderboardFrame.Rank.Text = "#" .. rank
leaderboardFrame.Username.Text = username
leaderboardFrame.Amount.Text = donated .." R$"
leaderboardFrame.Parent = script.Parent.LeaderboardPart.LeaderboardGui.LeaderboardList
end
end
And the TokenShop Scripts:
local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == 1320712810 then -- replace with your ID here
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
wait(2)
player.leaderstats.Token.Value = player.leaderstats.Token.Value + 10
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == 1320714102 then -- replace with your ID here
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
wait(2)
player.leaderstats.Token.Value = player.leaderstats.Token.Value + 150
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == 1320714459 then -- replace with your ID here
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
wait(2)
player.leaderstats.Token.Value = player.leaderstats.Token.Value + 500
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == 1320714757 then -- replace with your ID here
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
wait(2)
player.leaderstats.Token.Value = player.leaderstats.Token.Value + 1250
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == 1320715070 then -- replace with your ID here
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
wait(2)
player.leaderstats.Token.Value = player.leaderstats.Token.Value + 13500
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == 1320719832 then -- replace with your ID here
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
wait(2)
player.leaderstats.Token.Value = player.leaderstats.Token.Value + 32500
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
larket = game:GetService("MarketplaceService")
id = 1320712810
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
larket:PromptProductPurchase(player, id)
end)
I hope this Helps you❄️