How it works is that you attack first. A sprite of a dice plays an animation and a value between 1 and 4 is selected. The value dictates how much damage the enemy deals. Then the enemy attacks starting with when the function is called, then a similar thing happens there. The problem is that after the enemy attacks, both keep looping the script at random points and keep taking damage and I'm not too sure why. I've put print messages in and the order has gotten all over the place. I've linked a video to show what I mean. https://youtu.be/2xcQURrhdlk