Need help with cloning something then updating its pos

Im tryna do a game like BitLife if you played it but that doesnt matter

ok
so

Im trying to create a leaderboard function that creates a new Label and it below the label above
and Im using this script:

local Padding = 1;
local Pad = 1;
local NextP = UDim2.new(0, 0, 0, Pad);
local nextPosition = UDim2.new(0, 0, 0, Padding);
AgeT = script.Parent.Parent.Holder.AgeText
AgeM = script.Parent.Parent.Holder.AgeMesage
Holder = script.Parent.Parent.Holder

function plusage()
        local ObjectElement = AgeT:Clone();
        local Element = AgeM:Clone();
        ObjectElement.Position = nextPosition;
        Element.Position = NextP;
        ObjectElement.Parent = Holder;
        Element.Parent = Holder;
        
        nextPosition = nextPosition + UDim2.new(0, 0 , 0, ObjectElement.Size.Y.Offset + Padding)
        NextP = NextP + UDim2.new(0, 0 , 0, ObjectElement.Size.Y.Offset + Pad)
    
end

script.Parent.MouseButton1Click:connect(function()
	plusage()
	
	Pad = Pad + 0.40
	Padding = Padding + 0.40
	print ("work")
	
end)

it looks stupid but yeah ok

then it looks like this, it doesnt work the text goes into each other i tried other stuff didnt work:

ideas or anything please

You could try making a frame for the elements and using a uigrid or uilist layout to sort the frames automatically.

1 Like

I tried that it didnt work it does work for the few ones but then the Texts go into each other again

ok. can you DM me or post a repro file?

ok do you have discor or something

wait actually ur method works putting a frame in the elements i forgot to remove a error

1 Like