Hi! So I made a global leaderboard GUI that has a small issue. When the GUI is visible in game, the duplicated frame for each leaderboard player is spaced out around the size of the scrolling frame without scrolling. Here’s a picture to show:
I believe the UIListLayout has something to do with it because when I get rid of it, the frames are just stacked ontop of each other. Here is the script I use for the leaderboard:
local DataStore = game:GetService("DataStoreService")
local WinsLB = DataStore:GetOrderedDataStore("DonationLeaderboards")
local leaderboard = game.Workspace.Leaderboard
local function updateLeaderboards()
local success, errorMessage = pcall(function()
local Data = WinsLB:GetSortedAsync(false, 50)
local Winspage = Data:GetCurrentPage()
print("set leaderboard frame")
for rank, data in ipairs(Winspage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local userId = game.Players:GetUserIdFromNameAsync(userName)
local Wins = data.value
local isOnLeaderboard = false
for i, v in pairs(leaderboard.RealLeaderboard.SurfaceGui.Holder:GetChildren()) do
if v:IsA("Frame") then
if v.Player.Text == userName then
break
end
end
end
if Wins and isOnLeaderboard == false then
local NewLBFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
local statLabel = NewLBFrame.Stat
NewLBFrame.Player.Text = userName
NewLBFrame.Player.avatar.Image = game.Players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
statLabel.Text = Wins
NewLBFrame.Rank.Text = "#"..rank
NewLBFrame.Parent = leaderboard.RealLeaderboard.SurfaceGui.Holder
if rank == 1 then
NewLBFrame.Player.TextColor3 = Color3.new(1, 0.705882, 0.227451)
statLabel.TextColor3 = Color3.new(1, 0.705882, 0.227451)
NewLBFrame.Rank.TextColor3 = Color3.new(1, 0.705882, 0.227451)
elseif rank == 2 then
NewLBFrame.Player.TextColor3 = Color3.new(0.721294, 0.721279, 0.721279)
statLabel.TextColor3 = Color3.new(0.721294, 0.721279, 0.721279)
NewLBFrame.Rank.TextColor3 = Color3.new(0.721294, 0.721279, 0.721279)
elseif rank == 3 then
NewLBFrame.Player.TextColor3 = Color3.new(0.736507, 0.487678, 0.259174)
statLabel.TextColor3 = Color3.new(0.736507, 0.487678, 0.259174)
NewLBFrame.Rank.TextColor3 = Color3.new(0.736507, 0.487678, 0.259174)
end
end
end
end)
if not success then
print(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
local stat = player.leaderstats.Wins
WinsLB:SetAsync(player.UserId, stat.Value)
end
for _, frame in pairs(leaderboard.RealLeaderboard.SurfaceGui.Holder:GetChildren()) do
if frame:IsA("Frame") then
frame:Destroy()
end
end
updateLeaderboards()
wait(10)
end
Heres the UIListLayout settings:
And here us the scrolling frame settings:
Can you help me?