GMS 2 stop score from going up when room restarts

Hi everyone,
My game has a score and i want it so that when the player dies, the room restarts and resets the score.
Because i have a title screen when the player dies it goes back to the title screen
When i used “room_restart()” it restarts the room, but the score keeps going up
Can i have some help so that the score resets when the player dies?
 
You can reset the score variable in the Create Event on an object present in the same room as the player, every time he dies, you use room_restart() and the room will be reset. If you use the built-in variable "score", then just put it in the Create Event of an object in the same room as the player to reset the score:
GML:
score = 0;
If you use lives, just check if lives have reached zero, then go to the menu:
GML:
if lives <= 0{
    room_goto(room_menu);
}
 
You can reset the score variable in the Create Event on an object present in the same room as the player, every time he dies, you use room_restart() and the room will be reset. If you use the built-in variable "score", then just put it in the Create Event of an object in the same room as the player to reset the score:
GML:
score = 0;
If you use lives, just check if lives have reached zero, then go to the menu:
GML:
if lives <= 0{
    room_goto(room_menu);
}
yes i’m using the score variable.
Can i have some example code?
(i don’t know gml very well since i’ve just started using game maker)
 

FrostyCat

Member
yes i’m using the score variable.
Can i have some example code?
(i don’t know gml very well since i’ve just started using game maker)
You have been told exactly what to do:
GML:
score = 0;
Put this just before the line where you use room_restart(). I can't state this any clearer.

Being new to GMS 2 is not an excuse to not read your own code or ignore clear-cut instructions.
 
Top