Glitch with OK button caused by common event

While making my game, I've encountered a glitch where sometimes the OK button won't do anything if you try to interact with an event. I've tested it with the simplest event you can imagine (an NPC that displays text), and about 30% of the times, the event won run when you trigger the action button. After some tests, I've found that the culprit is the common event in the attached screenshot.

I have a stamina system where the character will move slower on map if MP = 0, but it seems to be creating this problem. Is there any way to fix it, or an alternative way to event the stamina system? Thanks in advance.

PD: I've already tried turning off every plugin and the rest of the parallel common events.
if the OK button is to press OK and ticks off, than the parallel is causing it.

what you can do is the following in a conditional branch:

if script => $gameVariables.value(58) > 0 && $gamePlayer.isMoving()

this makes it so, if you press OK to dash or walk, the speed is 4, else 1.
so if you don't move, OK should work on this point out.
Why is it running every frame? You should almost never have a parallel event without a Wait command in it.

This is issuing a move route to the character 60 times per second, so the player will have to hit the key at a specific time in order to get the input registered.

Is there any way to fix it, or an alternative way to event the stamina system?
There are both stamina/dashing plugins as well as better ways to event this, but without seeing the entire system you've made, it would be hard to tell you how to improve it. All I can say is if it's based off of character movement, it doesn't need to be checked every frame.
I added a wait command to the common event and the issue seems solved. I'll research for other ways to event it but for now I can keep going. Thanks!
It's also worth mentioning that, I think I recall Caethyril mentioning that move route commands are processed 1 frame at a time.
By having the move route set to the player, the game will override player input for one frame every time it needs to execute the move route. This definitely will happen with the move route set to "wait", but I think may happen even if "wait" is not set.

It may be better to use the change speed script call, but I don't know it off the top of my head. I'm sure a quick google search will turn up plenty of results for you.
It's also worth mentioning that, I think I recall Caethyril mentioning that move route commands are processed 1 frame at a time.
By having the move route set to the player, the game will override player input for one frame every time it needs to execute the move route. This definitely will happen with the move route set to "wait", but I think may happen even if "wait" is not set.

It may be better to use the change speed script call, but I don't know it off the top of my head. I'm sure a quick google search will turn up plenty of results for you.
I tried $gamePlayer.setMoveSpeed(value) and it worked, thanks!

Original thread: https://forums.rpgmakerweb.com/threads/glitch-with-ok-button-caused-by-common-event.172717/