hello there, so, currently im doing a leaderboard that uses UIListLayout to re-locate the frames that are added on the holder, i tested this on studio, but when i go to the actual game in roblox, the UIListLayout doesn’t seem to work, since whenever the leaderboard has more than 1 player (lets say it has 3 players on the leaderboard), it just overlaps the frames on the same spot, let me show you guys about the problem
on studio, the leaderboard looks like this:
but in-game, it looks like this:
and i add all the frames to the holder like this:
local success,errormessage = pcall(function()
local data = level:GetSortedAsync(false,10)
local levelpage = data:GetCurrentPage()
for r, d in ipairs(levelpage) do
local username = game.Players:GetNameFromUserIdAsync(tonumber(d.key))
local leveln = d.value
print(username,leveln)
local isonleaderboard = false
for i,v in pairs(holder:GetChildren()) do
if v:IsA("Frame") then
if v.Player.Text == username then
isonleaderboard = true
break
end
end
end
-- here is where the script adds the frame to the holder
if leveln > 0 and isonleaderboard == false then
local newframe = rankframe:Clone()
newframe.Player.Text = username
newframe.Rank.Text = r
newframe.Value.Text = leveln
newframe.Parent = holder
end
end
thanks to anyone who reply!
(and also, ik this isn’t scripting at all, but i think that almost everyone uses UIListLayout to organize their leaderboard with scripts, since its easier, so that’s why im putting this post on scripting support)
if leveln > 0 and isonleaderboard == false then
local newframe = rankframe:Clone()
newframe.Parent = script.Parent.SurfaceGui.MainFrame.ListFrame
newframe.Player.Text = username
newframe.Rank.Text = r
newframe.Value.Text = leveln
newframe.Parent = holder
end
end
the UICorner might mess up the newframe, if it does then i think creating another frame and putting the UIList and setting newframe.parent to it will fix it
Okay this is now a pure guess, put RankFrame into ListFrame, disable its visible property and then change the block of code to
if leveln > 0 and isonleaderboard == false then
local newframe = rankframe:Clone()
newframe.Visible = true
newframe.Parent = script.Parent.SurfaceGui.MainFrame.ListFrame
newframe.Player.Text = username
newframe.Rank.Text = r
newframe.Value.Text = leveln
newframe.Parent = holder
end
end
aw man, i feel so stupid, i found the issue, and i didn’t put it on the script part, you’ll see it now
so basically the method that i was using to update my list was this one:
while true do
for i,v in pairs(holder:GetChildren()) do
v:Destroy()
end
leaderboard()
print("updated")
wait(300)
end
and the error comes when it deletes ALL the childs on the holder, including the UIListLayout…
i’m really sorry guys to make you waste your time, like fr :’(( and also thanks for helping me out, and sorry again for making you guys waste your time trying to help me, it was my fault not to put all the script on the post ://
That would have been one way to do it, however now we’ve unvield he doesnt want to clear all the children anyway, as that would clear the UI list layout