how to run a procedure while key is held

Started by Rugbeat90999 on

Topic category: Help with MCreator software

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to run a procedure while key is held

I want to make a flying procedure, but I don't want to enable creative flying.

I have the flying procedure change there y velocity, so they travel up, the problem is it only applies the velocity once per key press, so you have to spam the key bind to go up.

I want it to be that you just hold the key and it constantly adds the vy to the player.

How can I do this.

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(variable page)Create global…
Fri, 07/14/2023 - 18:44

(variable page)Create global player lifetime logic variable, default false.
(global trigger)On player tick update, if variable = true, run the procedure you want.

(key binding)On key pressed, set variable to true

(key binding)On key released, set variable to false

 

that should work