UiListLayout not working on actual game

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:
image

but in-game, it looks like this:
image

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)

Can i see the leaderboard in explorer? I think it has something to do with the parent of the newframe clone

there, the frame that is marked is the one that holds all the other frames that are added

image

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

i removed the UICorner of the ListFrame, i think that would work the same as your solution, but it is still not working in-game, just in studio :confused:

1 Like

Is it set to archiveable? Instance.Archivable

The UIListLayout or another part?, if you’re talking about the UIListLayout then yeah it is

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 ://

5 Likes

Why not just holder:ClearAllChildren()?

1 Like

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

1 Like

lmao i needed this thanks i did the EXACT same thing

2 Likes

stop me too i cant believe i overlooked ts :wilted_flower:

am i dumb or are the level player and rank not even in the list frame