Arcade Makecode Code glitches

Why does Arcade break sometimes? In my game Monkey Madness I decided to change the input from hold to single press (so using pauses) but when I ask for it to wait 50 milliseconds, it waits for way more than that. I KNOW that this is a bug because in many of my other speed ran rhythm games, I used that same system, but it waited for the correct amount of time.