25.07.2016, 23:01
The problem is whole design of the system, you need to set internal states and player states this script neglects the primary design fundamentals to be properly functional. What that means is you need to define routines for every situation between player and system to ensure there is no undefined behaviour.