How you have the player take damage seems to work fine (maybe consider using Parent objects so you don’t need so many Collision behaviors), it’s only the Lives system that needs to be altered.
The problem other people encountered is they thought the deduction of lives was the system to reset the game. However if the player was on the 2nd level it would be more apparent. You want to restart level 2 when you die, but if you die 3 times it takes you back to level 1.
{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Set Lives","behaviorType":"logic.NodeGroup","x":-450,"y":696,"group":"","id":"5abc5ab29f863146","isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":696,"group":"5abc5ab29f863146","id":"120b79e32de7704c","startVal":3,"tag":"Lives","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-270,"y":696,"group":"5abc5ab29f863146","id":"120baec45b21634f","tag":"Lives:Number","version":2,"dataType":2},{"inputCount":1,"outputCount":1,"name":"RestartGame","behaviorType":"logic.gameflow.RestartGame","x":270,"y":608,"group":"5abc5ab29f863146","id":"1210d49b618acf4b"},{"inputCount":4,"outputCount":4,"name":"Label","behaviorType":"logic.hud.Label2","x":90,"y":784,"group":"5abc5ab29f863146","id":"12150e40e2896940","text":"0","textColor":16038674,"fontName":"oduda","scale":10,"textAlign":"left","maxWidth":0,"xO":1060,"yO":29,"pin":false,"alpha":100,"kerning":0},{"inputCount":0,"outputCount":1,"name":"Once","behaviorType":"logic.triggers.Once","x":-450,"y":696,"group":"5abc5ab29f863146","id":"120ceac13ec4c544","resetOnLevelStart":false},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":696,"group":"5abc5ab29f863146","id":"5abcef2cd14fa74b"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":90,"y":608,"group":"5abc5ab29f863146","id":"5ac71a44aba4db4f","_startVal":0,"dataType":2}],"links":[{"input_id":"120baec45b21634fi0","output_id":"120b79e32de7704co0"},{"input_id":"5abcef2cd14fa74bi1","output_id":"120baec45b21634fo0"},{"input_id":"120baec45b21634fi1","output_id":"120ceac13ec4c544o0"},{"input_id":"5ac71a44aba4db4fi2","output_id":"5abcef2cd14fa74bo0"},{"input_id":"120b79e32de7704ci1","output_id":"5abcef2cd14fa74bo0"},{"input_id":"5ac71a44aba4db4fi1","output_id":"5abcef2cd14fa74bo1"},{"input_id":"12150e40e2896940i0","output_id":"5abcef2cd14fa74bo1"},{"input_id":"1210d49b618acf4bi0","output_id":"5ac71a44aba4db4fo0"}]}}}
What this does:
First, it gets the Lives value, if it’s equal to 0, it sets it to 3. This allows the game to set the lives, but not set it if there is already a value there.
The Switch is there to prevent the game from restarting when it’s not supposed to. To output from the Switch, it requires a value greater than 0 to turn On. So 0 → 3 won’t cause it to output because it needs a value greater than 0 first
However, 1 → 0 will work because it first gives a value greater than 0.