Shop numbers not syncing

Hey hey! Trying to figure out how to fix this. So a menu is supposed to pop up when the player dies and pop up with this kinda shop thing. I'm trying to make it so when it's purchased it tells you the amount of play points you have. That is set up and shows play points - 3. But in the main menu when it shows how many i actually have it still shows the original amount of play points before the subtraction. I need this number to be the same. `on draw do

call "repeat"
once "song 2"
label "{score}" at 23,0





if score>=5 then
	emit "changeDifficulty"
end

end

on cancel do
if highScore>=20 then
if canUseB>=1 then
canUseB--
emit "getThePoints"
end
end

end

on repeat do

wait 5 then
	call "repeat"
	
end

end

on damagePlayer do

restore "highScore"
restore "playerPoints"

if canGo == 1 then
  	playPoints -= 3

store "playPoints"
  end

if score>highScore then
	highScore = score
	store "highScore"
	
	
end

menu at 0,1,4,4 then

	restore "notBought"
	if notBought==true then
	  	restore "playPoints"
		option "One" then
			
			ask "This spends 3 play points, are you sure?" then
				
				
				
				option "Yes" then
					
					  canGo=1
					 
				
					
					
					say "purchased {playPoints}"
					notBought = false
					store "notBought"
					store "playPoints"
					
				end
				
				option "No" then
				
				end
			end
		end
		
		
		
		
		option "Two" then
			// do another
		end
	else
		say "Not Enough! You Need 3!"
	end
end
restore "playPoints"
fin "you scored: {score} high score: {highScore}, you have {playPoints} Play Points"

end

on load do
subtractPoints = false
end

on plusOne do
sound "chicken"
score++

end

on loop do
label "{score}" at 24,0

end`

During the damagePlayer event, is there a reason you're restoring the playPoints variable?

It's my understanding that when you ask pulp to store a value in persistent memory, the system actually waits until a room transition or the fin event before actually storing that value in persistent storage. So in effect by restoring the playPoints variable during the menu function, you're just returning the value to the old number before you reduced the number by 3. I would try removing the restore function and seeing if it works!

I found the persistent memory functions a little unintuitive at first, so hopefully this helps!