How to make data save all current state of game (guis,events,playerposition)

i want to save the whole game state when the player leaves

as this game has quests i wanted it to save the current gui quest, the player position, doors opened and the rest

how could i do this?

When the player leaves the game, use a script to collect the necessary information, like current quests, their position, which doors are open etc, you might need to modify some of the things you want to save to get the right data (i.e. a bool to check which doors have been opened)