Double tap/hold button B to teleport problem

Hi, any ideas or knowledge as to why this is only sort of working. The aim is, to double tap “button B” to return/teleport to the start of the current area you’re in, and/or, to hold down button B for at least 2 seconds before releasing to teleport to the game’s lobby. A white ring appears around the “buttonB” image when the button has been held down for 2 seconds letting you know that you can now release to teleport. I’m hoping someone will immediately be able to identify what the problem is, or likely is from looking through the code, rather than me trying to describe the undesired occurrences. Thanks in advance for any help given.