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