Im not looking for you to critique the code, im just looking to see why its not working. This isn't even the code im using so im not even sure if it works. Im just trying to give an example of what im trying to do.

Now on to the problem. It will only send the z key once after the timer has went off.

How can i reset the timer so it will repeatedly call the function ever 5 sec?

Im not looking for you to critique the code, im just looking to see why its not working. This isn't even the code im using so im not even sure if it works. Im just trying to give an example of what im trying to do.

Now on to the problem. It will only send the z key once after the timer has went off.

How can i reset the timer so it will repeatedly call the function ever 5 sec?

One you add a "then" in your "if-then" statement this segment of code will actually run. When it runs, it does trigger every 5 seconds like it's supposed to.