Assemble load-on-join, save-on-leave, autosave, and the secure click flow from shuffled lines.
Saving looks simple in a code block, but the order is where the meaning lives — and where bugs hide. This lesson has you assemble each piece of the save system from shuffled lines. Same rule as ever: code runs top to bottom, and an object must exist before anything uses it.
Put a returning player's coins into their new leaderboard. Order matters: the player must exist, the value must load, and the NumberValue must be parented before it can show.
The moment a player leaves, write their real progress back. The key and value must go in the right slots.
Back up everyone's data every minute — wrapped so it never blocks the rest of the script.
The client reports the click; the server verifies, awards, and tells the client the new total. Order the server side.
Put together, those four scripts are the entire data system: load on join, save on leave, autosave in between, and a server that owns every change. If you can order them from memory, you understand persistence.
Why does the autosave loop run inside task.spawn?