Is it possible to make a cooldown of 0.0006 seconds?

i was messing around in studio with my barebones gun system and i was making an automatic firing mode. in the module script for the gun, i have information like the firerate per minute, and i think you can tell what i was about to do… what if i put fire rate at 100000??

so at first i was using wait() and then i realized it was a bad idea considering what i have to do to use wait() uses more resources and the lowest wait() can go is 0.03 and because of that it caps out the firerate at 2000 (60/0.03) so then i realized i can just use tick().

i did that and i was able to significantly increase the fire rate. i did that by using renderstep to check every frame if the time has passed the cooldown. but then i realized it capped again…

i realized that if you put a super high fire rate, the time that it takes for the cooldown to finish will finish before the framerate can catch it. (so a firerate of 100k finishes a cooldown in 0.0006 seconds(60/100000), but my fps at 144 fires renderstep every 0.00694 seconds (1/144) which as you can see is slower than the cooldown) (and this is also inconsistent because if you have low framerate then you cant get close to catching the cooldown around the time when it finishes causing a slower fire rate than intended)

so then im stumped here, i cant solve a problem to something stupid and unnecessary, and idk if this can even be solved ??

is there a way to fire a line of code immediately on cooldown finish? or is it impossible? (im basically asking if its possible to wait less than a milisecond.)

Two issues to consider:

  1. Hardware constraints, you can’t go below nor above a certain limit. Machines are fast, but not THAT fast… but also not THAT spacious.
  2. Let’s assume that you somehow managed to wind up with a fire rate of 100000. You’d expect performance issues and throttles from all that. :slight_smile:

Not to mention some parts are proportional to the frame rate and would be slightly unfair if someone had a super computer against someone with a potato.

1 Like

This module should allow 1/180 second precision, not exactly what you want but more precise than 1/60

1 Like

I think you have to check the topic again, knowing there are some cautions of trade-offs if it was being used: