How would I make a inventory slot save system?

How could I make a system so whenever the player like moves a tool in their inventory it will save that placement for that specific team?

So let’s say I rearranged my inventory, it will save and rearrange my inventory automatically if I die and respawn as that team or if I rejoin and whatever.

You’ll have to serialize each tool and pass it onto the server.

First, make a remote in replicatedstorage, have a folder of all the tools in serverstorage, and create a serverscript that would receive the call when that specific remote you created is fired from the client

Second, in the client, fire the remote when neccessary. (For example, when you die, change teams, etc. Don’t fire at the client when player is leaving!)

Third, In the script in serverscript, when it receives the call, loop through the player’s backpack using for i, v in pairs and save it in a table. And when the player is leaving, save that table data from that specific player in datastore.

Fourth, in the script in serverscript, check if the player has rejoined, changed teams, respawned, etc. Then loop through the table (where each tool is serialized), and find the names from v in the folder where you have all the tools and clone it to the player’s backpack.

(Yeah, I think based on what Forummer had stated, when you loop through the player’s backpack, it gets the first tool to the end Ways to find what number tools are on? - #11 by Forummer)

(Also, don’t trust the client to handle looping through your backpack and send the data to the server! Exploiters can easily fire a remote and send false data if you do that)