Hi!
I’ve been trying to create a system which checks for a mouseclick each frame, yes I know this is poor on a performance point of view however as far as I’ve tested it seems to be the exclusive method to ensure complete functionality.
It works, however as expected, frames are rendering in the time that it takes my script to execute.
Problem
The above pasted code current works well, however in the time that the Button1Down event if fired, the game is stepping multiple frames as seen below:
I’ve tried to add a debounce boolean variable which tries to check whether the code has already been run:
This does reduce the times the code is executed, but by an insufficient amount (20x instead of 27x).
I’ve also tried using the wait() function inside the Button1Down function however the count reduces to only 12.
I’m trying to reduce the execution so that it only runs once.
Any suggestions on how to improve this system would be much appreciated!
Thanks -Tom