Hey there☃️,
i added to my Game a Donation Board and a “Token” Shop (Currency Shop) and they both works with Developer Products. Now there is the Problem when i buy something in The TokenShop (we say 32500 Token) for like 250 R$ they will added to the Donation Board (Top Donations) and you don’t get the Tokens you Bought. I use diffrent DeveloperProduct ID’s for the Both but they still connect with each other. I also checked if there is anything wrong with the scripts but there is not Problem i don’t understand it please help.
Scripts DonationBoard:
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
local donateList = workspace:WaitForChild("DonationBoard").DonatePart.DonateGui.DonateList
function handleDonateButton(button)
button.MouseButton1Click:Connect(function()
game.ReplicatedStorage.DonateRE:FireServer(button)
end)
end
for i, child in pairs(donateList:GetChildren()) do
if child:IsA("TextButton") then
handleDonateButton(child)
end
end
donateList.ChildAdded:Connect(handleDonateButton)
Scripts TokenShop:
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 = 1320719832 -- replace with your ID
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
larket:PromptProductPurchase(player, id)
end)
Thx for any help🌟