So I have been trying my hand at making my very first game. it's going pretty well so far. I have run into an issue i can not solve. When the player's health reaches <=0 the game should end and reset. It was working fine for the whole thing until recently. When the player dies from enemies the whole game just freezes with 1 health left. it works fine when the player is damaged from spikes though. i just don't understand what i did to break it. the enemy and damagePlayer scripts are basically copy and pasted from SquidGod's "simple combat" tutorial
When you say it freezes, is the game crashing?
If you're testing in browser, open the developer tools console. You should see an error appear there if the game is crashing which might help you fix the problem.