I have a PlayerDeath function that I call when my Player object hits a spike or falls off the screen (out of layer bounds).
Inside the PlayerDeath function is a Wait command in order to display the Death animation, screen shake, and sound effect before restarting the layout.
This works perfectly when hitting a spike.
But when the player falls off-screen, the PlayerDeath function plays the sound effect repeatedly at the same time (so it sounds much louder). This behavior doesn't happen with the spike, even though the Spike collision and the falling off-screen both call the exact same PlayerDeath function. I'm not sure what the difference is and why the spike collision works perfectly but falling off the screen does not.
I've included a picture of the PlayerDeath function (I'm very new so apologies if the code is amateur).
The way I'm calling the function is either:
Player -> Spike collision: Call PlayerDeath
or
Player -> Is outside layout: Call PlayerDeath
Why does one work perfectly and the other causes the sound to mess up?