hey there ! you need to use the savegame system for that : here is the documentation :
and a tutorial: