I have this search GUI and I want it to sort the lowest prices higher and the larger prices lower.
sort script:
table.sort(Items:GetChildren(), function(A, B)
if A:IsA("GuiButton") and B:IsA("GuiButton") then
return (A.PurchaseItem.Values.ItemPrice.Value > B.PurchaseItem.Values.ItemPrice.Value)
end
end)
You are using the wrong comparison operator. The table.sort method, by default, is documented to use < for it’s sorting. That’s also the way to sort in ascending order, which it seems is what you want. Right now, with using >, you are sorting in descending order.
return (A.PurchaseItem.Values.ItemPrice.Value > B.PurchaseItem.Values.ItemPrice.Value)
--Change ^this to <