Toss isn't working properly on "new game" option

Hi everyone!
So, I have a "new game" option in the title room in my game. In it, I use toss to erase all the stored variables. But then, as you go into the first room of the game all the variables stay as they were, the toss seemingly having no effect. If you close the game and open it again, choosing the continue option, the toss you did earlier has worked, and all the variables have been erased.
Why is thet happening? I tried to use toss then restore, to no avail.
This is how the code is currently written:

on enter do
	playertype = "player"
	restore "continue_room"
	menu at 9,11 then
		if continue_room!=0 then
			option "Continue" then
				restore
				restore "sanity"
				goto continue_x,continue_y in continue_room
				unseen = 0
				death = 1
			end
		end
		option "New Game" then
			toss
			restore
			goto 12,9 in "prologue"
			acts = 1
			playerdirection = "up"
			death = 1
			sanity = 10
		end
	end
end

Thank you all so much!

You are still calling restore after toss in the "New Game" option. Remove that and it should work!

For some added understanding, toss marks the persistent storage to be cleared but I don't think that happens immediately on disk, instead waiting for the next room transition. Calling restore immediately after toss means the data is still all there to be restored as it hasn't actually been deleted yet.

That unfortunately doesn't seem to work for me :frowning: it still seems to only affect the game after you exit and go into the game again. The only other place that has restore is in the load event in the game tab.

Ah, that'll be the problem! When you call restore all of the variables in persitent storage get loaded by the game. When you call toss the persistent storage gets cleared, but any variables in use by the game are unaffected. If you're calling restore on game load then all of those variables are already being loaded.

You should remove restore from game load and instead only call restore from the "Continue" option. You'll need to restore "continue_room" separately, but you're already doing that!