Is there a way I can put an object inside of a table and order it based on what its number attribute returns?
basically, a loop gets a bunch of objects with attributes, each with a number inside of the range of 1-7, then it is put into the table and ordered based on what the attribute returns. so if the attribute returns 1, then the object is in the first place, if the attribute returns 5, then the object is in the fifth place.
i’ve just given it a try and it’s spitting out an attempt to index nil with 'GetAttribute'
all the objects that are being put into the table for sure do have a number attribute called Placement
snippet of the code
table.sort(stationsTable,function(a, b)
return a:GetAttribute("Placement") > b:GetAttribute("Placement")
end)