How to stop spam input for shooting?

Ok so my goal is to make a foot ball type practice game its a first person experience where you throw the foot ball. Well I want to make it so after the player throws it they have to wait an X amount of seconds before being able to fire again. Im new to unreal so im sorry if this seems like a dumb question. Also im using the First Person Blueprint and the only changes I made to the gun and projectiles is that the balls now look like footballs thats it. Also its configured for gear vr if that helps.

you could set a boolean after you shoot the first time and toggle it back after a certain amount of time. With this boolean you able/ disable the shooting imput

But how would I go about doing that in a blueprint?

This is how I usually add forced time between inputs.

This is what I have so far

Still need answer Bump

Here’s a possible way to do it using blueprints. You need to create a boolean variable that will define if the player can shoot or not. You’ll also need to create a float variable to define the cooldown between each shot.

The player can only shoot if the boolean (CanShoot?) is enabled.

Once you shoot (pressing F in my example), you set a Timer Event that will call another event when the timer (defined by the cooldown variable) is completed. Shooting should also disable to CanShoot boolean by setting it to false.

The event called by the timer will just set the CanShoot? back to true, allowing the player to shoot again.

See the blueprint example below.

1 Like

This is probably the best way to do it, as there is no problem with the possibility of float imprecision after the game has been running for a while, it’s also very clean and simple.