How would I make an Item despawning system

Anyone got an idea on how I could make a item despawning system? I have a folder with all of the items that are dropped on the ground. I want to make it so that when there are more than 20 items on the ground, the one that has been dropped for the longest will despawn (the last item). A feature that games like booga booga and islands have. I don’t need any scripts nor help making them. I just need an idea on how I would achieve this.

Whenyou drop a item, it would be added to a table. Whenever the table’s length is over 20, destroy table[1] and remove the table’s first index using table.remove after you’ve destroyed it

6 Likes