Donation Board Bug

I have a donation board in my game but the leaderboard isn’t working properly. Right now I have 2 friends who donated but their username and the donated amount is overlapping like the image below.

I’m not sure how to fix this and I know nothing about scripting.

The rank, username and amount are all overlapping

Script:

local donateAmounts = {10, 50, 100, 500, 1000, 5000, 10000}
local ids = {1232907010, 1232907009, 1232908323, 1232908337, 1232908358, 1232908376, 1232908422}


local mps = game:GetService("MarketplaceService")

local dss = game:GetService("DataStoreService")
local ods = dss:GetOrderedDataStore("Donators0.1")



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(10) do
	
	for i, child in pairs(script.Parent.LeaderboardPart.LeaderboardGui.LeaderboardList.ScrollingFrame: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
		
		leaderboardFrame.Parent = script.Parent.LeaderboardPart.LeaderboardGui.LeaderboardList.ScrollingFrame
	end
end
1 Like

I feel like this should be a bug within your scrolling frame.

You need to actually change the position for the frame.

leaderboardFrame.Position = UDim2.new(0, 0, leaderbordFrame.Size.Y.Scale*rank, 0)

I’m assuming its going off of scale, if not, use this:

leaderboardFrame.Position = UDim2.new(0, 0, 0, leaderbordFrame.Size.Y.Offset*rank)

Where would I add this script?

Add it right before you parent the new frame.

Use a UIListLayout instance and parent it to the ScrollingFrame instance (it’ll display the rendered child instances of the ScrollingFrame instance in a list format). Set the properties of the UIListLayout instance to your needs.

1 Like

Fixed it, thank you. I already had a UIListLayout but it was in the LeaderboardList frame and not the scrolling frame.