Organise in Order

So I’ve got a system that allows players to create parties, this is done by having a folder with 4 string values inside of it, each string value a space for a player to join that party, the strings are named “Member1”, “Member2” and so on… Member1 is always the party leader. What I’m struggling to do is create a script in-which monitors the values for any changes, in-case for example Member3 leaves, I’d like them to become Member2 so there’s no gaps in the party. Any ideas on how I’d do this?

table.sort() is what you’re looking for, bare in mind it’ll only work for arrays & not dictionaries.

I see! How would I apply that here? I don’t know very much about tables.

Do you mean leaves the party or leaves the game? If you have some system in place which allows players to leave the party then you could just add to that to shift any existing players.

you could also use ipairs, it does the same but increases performance and shortens code