Gear Save System Modifications for "Game Not Loading" Issue

I am currently using a system in one of my games to save the items in a player’s backpack as a datastore list, which can be loaded if they were to rejoin. The system uses Players.PlayerRemoving to capture the items in a player’s backpack right before they leave.

Sometimes (often on mobile), when a player joins the game, they are met with an empty void where none of the game’s assets load. Only the sky can be seen. The player is forced to rejoin as nothing is loading.

The system appears to try to save the player’s unloaded backpack, causing them to lose their saved items upon rejoining.

What modifications can I make to the system to help resolve this issue? (Note that I currently don’t have access to my code to provide it/point things out)

Thanks! :slight_smile:

Simple fix, when saving make sure the data isn’t empty or default. Also make sure to also save on game closing

I was going to ask what to do if the player was leaving while actually not having anything in their inventory, but realized that I wouldn’t need to save anything if they didn’t have data to save in the first place. :smiley:

Thanks for the solution, I’ll implement and test it soon.

1 Like

It turns out I was right, there is one more issue with the system:

If a player has 6 items (for example) and then removes all of them, the system would register the player for having zero items correctly and not save. When they rejoin, they would have those original 6 items as if they never removed them.

What can I do to fix this? I would need a way to distinguish between the two scenarios.

Player joins: Create save file for them in any case.
Player gets 2-3 tools: save
Player drops and leaves: save
Player rejoins: load what saved - 0 items.

To prevent issues like your original one, make session locking.

Create a player bool value and name it like “BoolSaved”, parent it to the player then if loading was successful make the bool value change to “true”. Then when saving check if “BoolSaved” was true.

Another way you can fix this is by saving empty tools not as “nil” but as string value “empty”, “empty” means the player has no tools while “nil” means there isn’t any data (aka new player).

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.