I need help with a script that makes my hand bob left to right when a key is pressed. The entity will repeat this action until that key is released.
What is bobbing? Can you show an example?
Moving left to right until a key is released. The action starts when a key is pressed
I suggest to take a look at the topic below. You probably can apply something like that.
I would recommend using the tween library for that, as you can see the first example here:
Using the Tween library | Learn PlayCanvas , the box is moving back and forth, you can easily start/pause/stop the tween based on key press.