Donation Board Bug

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❄️

1 Like

I can help you that you have something that a problem
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

1 Like

Thank you for Helping me, i will test it now a few Times if it really works

I am really sorry for Bothering you but now is the Donation board don’t working anymore

But what is the problem tho that you found? It could help him.

All scripts you’ve posted here is all scripts that is related to the leaderboard right? Else I might know the issue.

Yea thats all scripts of the Donation Board

1 Like

Do you know the difference between :GetOrderedDataStore() and :GetDataStore()

I think is litteraly the same?

Nope, they’re not.


:GetDataStore() vs :GetOrderedDataStore()


:GetDataStore()

:GetDataStore()

GetDataStore(name: string, scope: string, options: Instance): GlobalDataStore

Creates a DataStore instance with the provided name and scope.

This function creates a DataStore instance with the provided name and scope. Subsequent calls to this method with the same name/scope will return the same object.

Using the scope parameter will restrict operations to that scope by automatically prepending the scope to keys in all operations done on the data store. This function also accepts an optional DataStoreOptions instance which includes options for enabling AllScopes. See Data Stores for details on scope.


:GetOrderedDataStore()

:GetOrderedDataStore()

GetOrderedDataStore(name: string, scope: string): OrderedDataStore

Get an OrderedDataStore given a name and optional scope.

This method returns an OrderedDataStore, similar to the way DataStoreService:GetDataStore() does with GlobalDataStores. Subsequent calls to this method with the same name/scope will return the same object.


Solution (to fix script)

At the first script, you can see here:

local dss = game:GetService("DataStoreService")
local ods = dss:GetOrderedDataStore("Donators")

You did dss:GetOrderedDataStore(“Donators”) instead of
dss:GetDataStore(“Donators”)

So replace it with:

local dss = game:GetService("DataStoreService")
local ods = dss:GetDataStore("Donators")

Source: DataStoreService | Roblox Creator Documentation

Hope that was useful. Just so you know, I didn’t test anything I showed you here; this is one problem I encountered. But there was a problem with that section.

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

This is the Code i actually use do i need to change OrderedDataStore?

1 Like

Change

local dss = game:GetService(“DataStoreService”)
local ods = dss:GetOrderedDataStore(“Donators”)

to

local dss = game:GetService(“DataStoreService”)
local ods = dss:GetDataStore(“Donators”)

Additionally, I’m not certain if this resolved the problem, but what I showed you was a script problem.

1 Like

Not the whole code :rofl:, just the part that I did show you. If you do not know where that part is, change the whole script to this:

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:GetDataStore(“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

Tell me if it did work.

1 Like

I trie it when i am at Home and is just wanted to show you the new Script i use :joy:

Its not working it says:

GetSortedAsync is not a valid member of DataStore “DataStoreService.Donators”

I forgot to send the Script from StarterPlayerScripts:

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)