UI button positioning problem

I have a ScreenGui, and I have a frame called “sideframe” which is supposed to be just buttons. The buttons are supposed to be loaded into the UI using a function ( :createNew() )

My problem is that these buttons won’t separate. And I don’t wanna use UIListLayout due to positioning issues. I’ve tried many different things and they don’t really work so I’m resorting to dev forum to see if anyone can pick out simple mistakes or something.

image

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Inside the function, I’ve tried for loops and all sorts.

for i = 1, (#tabTable) do 
	tabTable[i].Position = UDim2.new(0, 0, 0, tabTable[1].Size.Y.Offset * i + 20)
end

“tabTable” is a table in which I inserted all the buttons made from the function. So that I could then get button for button afterwards, but it doesnt seem to be doing much help.

I just need to separate each one of them like UIListLayout would, without using it.

1 Like

I notice you’re using offset? I’d highly recommend using scale for almost anything related to UDim2 sizes.

1 Like

Yeah I figured, I’m using offset for this one because I’m mainly just focusing on trying to re-position those buttons for now.

I just need to fix this part and then I’ll be good to go! :smiley:

1 Like

I actually think that line of code might’ve solved my situation.

1 Like
local first = tabTable[1].AbsoluteSize.Y
tabTable[i].Position = UDim2.fromOffset(0, ((i * 20) + first) - (20 + first))

on mobile so sorry if there’s any mistakes

1 Like

UIListLayout, have you ever used it?

1 Like

This one gave me the best results. I’ll take a look into ( fromOffset ) - Didn’t know these existed but it seems very useful! Thank you.

1 Like

Yeah I have but they gave me lots of issues when it came to me tweening button size and such. ( effects became useless )

2 Likes

I really don’t think my solution worked, ahah. I completely messed up there.

Nevertheless, in what way is it not working as you want it to currently?

I think they’re fairly recent additions. I only learnt of their existence a couple months ago.

1 Like

It seems to be working now with @ClockworkSquirrel’s method! Thank you so much for the help though.

1 Like