Hi,
I saw your sample code and I guess you are trying to limit the shot rate of a weapon. I will show you one solution I use, others are possible.
I use a Timer node with mode One shot and allow the player to shot only if time left of timer is equal to 0. In the if (when allowed to shot) I set the wait time of timer to the shooting rate expected and re start the timer.
if (Input.is_action_pressed("shot") and get_node("BulletTimer").get_time_left() == 0):
# some shot code....
get_node("BulletTimer").set_wait_time(SHOOTING_RATE) # set the new wait time for the time
get_node("BulletTimer").start() # restart the timer
Timer node :
Process mode : Idle
Wait time : 0.01
One shot : checked
Autostart : checked
Wait time to 0.01 and Autostart checked is only here for the start of the game, before the first shot ! After the first shot you manage it by code