Getting the place number of a frame inside a grid layout?

Basically I wanna get the number of what position the frame is inside a grid layout.



There is a property called LayoutOrder. It tells in which order the frame inside the parent is (in ascending order)

Not to be “that guy” but is there a way to set the LayoutOrder automatically?

Set the LayoutOrder to be based off of LayoutOrder.

local frameDirectory = -- Location of an example frame.
local guiDirectory = -- Location of the frames.
local frame = frameDirectory:FindFirstChild("Frame");
for i = 1, 4 do
   local fr = frame:Clone();
   fr.Parent = guiDirectory;
   fr.LayoutOrder = i