I’m currently attempting to sort a table that is created from :GetChildren() alphabetically in the following code
local ImageButtons = {}
for _, button in ipairs(GUI.Frame:GetChildren()) do -- Loops through all children inside GUI.Frame
if button:IsA("ImageButton") then -- Checks if the child is an ImageButton
table.insert(ImageButtons, button) -- Adds the ImageButton to the library
end
end
table.sort(ImageButtons)
The table.sort gives the error “attempt to compare Instance < Instance” which I understand is because it is trying to compare the instances inside the table. Is there any way that I can sort the table?