(Solved) The global score variable is not initialized

Hello all.
I created a score as a global variable that sums the score across multiple stages.
I created an event with the action of pressing the replay button to show the score(ScoreLabel) when the game fails, and then reset the score to 0 when starting a new game.
However, the score is not reset to 0 and the replay game starts with the previous score. How can I get the score to return to 0?

  1. Check the GameState Condition:
  • The variable GameState must equal "Lost" and this event is triggered once. If GameState does not match "Lost" at the exact moment, the reset action for GlobalScore will not execute.
  1. Replay Button Logic:
  • Resetting GlobalScore is nested within the conditions for the cursor/touch being on the Replay_Button and the left mouse button being released.
  • If either of these conditions fails (e.g., the Replay_Button is not properly clicked or detected), the GlobalScore reset will not occur.
  1. Trigger Once:
  • The use of “Trigger Once” can sometimes cause issues in complex event logic if the event conditions are not consistently true. Ensure GameState is properly updated and matches "Lost" before clicking the Replay_Button.
1 Like