How to know how many slots there are in a row in a grid layout

I want to know how many of this;
There are in a grid layout automatically
Some resolutions are different so sometimes there’s 2/3/4
So I want to know how many slots are in a row, how can I achieve this?

You will want to get the size of one slot, and the size of the entire row.
Then you can do division to see how many fit.

If each slot is 50 pixels, and the entire row is 225, then we can do 225/50, and get 4.5. We don’t want a decimal, so then you can round down using math.floor(4.5), giving 4. And that would be how many slots fit.

I should also mention that there are properties for this, such as GuiObject.AbsoluteSize

1 Like