How to make Tools in your inventory save when you leave but deleted when you die?

What I want: I want players’ tools in their inventory save when they leave the game and rejoin to have it back in their inventory. If they die they lose all the items in their inventory and are wiped regardless if they rejoin.

Similar to the one criminiality

1 Like

you can make some data saves and functions for the “save when you leave” part!

and make a script that’s always checking if your health is <1. and then delete all the items from your inventory!

Hope this helped!

did something like that but the tools still saved on respawn and when you leave the game despite dying

I mean delete the tools from StarterPack (on the client side obviously)
and you can just add more data stores to check if you have the items or not!.

Make sure to be careful about your data stores, because to much data saving can lead to data loss,
I would recommend datastore2 but you can do as you want!

1 Like

I would recommend putting the tools in Replicated Storage, and Clone them into Starter Pack instead of putting them into Starter Pack in studio, this way you have more control over if the player has items or not!

what about default tools that I want players to still have in their inventory regardless if they die?

then you can put those tools in Starter pack manually!

anything in Starter Pack goes into your inventory!

1 Like

Simple, just use DataStore to store the item’s name, which is in string format, then when they die, just remove their tools in your own logic.