Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this for loop sort the parents by 2 each?

Asked by 6 years ago

Im pretty much creating a page layout gui. I want each page to list 2 employees, but they are created with a for loop. This for loop clones each employee in the list and then lists them in a page gui. I sort it by having the employees inside their own frames, so the UiPageLayout sorts the frames, instead of employees. It works well, but my thought is once a player has so many employees, going through them page by page is tedious. Id like to sort them by 2 instead to make it easier in the future. My idea is to have a UiGridLayout sort the employees inside each frame to have them side-by side, and then the UiPageLayout sort the pages. My idea works well, I have tested it with precreated "EmployeeCard" however in reality they will be created based on a folder containing the employees, which are then cloned. How would I make this for loop sort the parents by 2 each? Meaning it clones 2 employees into a frame, then clones 2 more employees into a different frame, and continues until all are done, so that then I may go through them like pages.

            for i, list6 in pairs(game.Workspace.Employees:GetChildren()) do
                local EmployeeCard = game.ReplicatedStorage.Employee:Clone()
                EmployeeCard.Parent = Instance.new("Frame", EmployeeList)

Or is there a simpler way to do this?

Answer this question