I have the parts in a model as a table, and I am trying to order them in order of position. Here is my code.
local house1 = game.Workspace.House:GetChildren() local sortedhouse = table.sort(house1, function(a,b) if a:IsA("Script") or b:IsA("Script") then else return a.Position.Y > b.Position.Y end end) print(sortedhouse)
I check to make sure the items arent a Script as the script containing this is also in the model. There are no error messages however, when I print sortedhouse it prints a nil. Anyone know How I can fix this to properly order the parts from lowest position to Highest?