[HELP] Inventory sorting

What I’m trying to accomplish is essentially an inventory sorting system that goes from server to client.

I’m trying to have the inventory “slots” be A-X. How would I go about checking to see if A is a value, go to B, if B is a value, go to C, etc.

So when a new StringValue is added, it’ll have a value of A. So the next StringValue should have a value of B. If B gets removed, B should be a valid value again.

This is fairly simple.

table.sort(tableyouwanttosort, function(a,b)
	return string.lower(a.Name) < string.lower(b.Name);
end)

This of cores rely on the fact your item in the inventory has a “name” variable.

But, I’m not really sorting a table. I’m utilizing StringValues in a folder. The actual name of the StringValue is the “object’s name”, then the StringValue.value will be the next available inventory slot. Which is why I’m trying to first find a way to check the values efficiently.

1 Like

If you need a visual representation