How to check how long a key is held

I’m trying to make it so when my player character taps the shoot key they shoot a regular bullet and when they hold the fire key for X amount of time they shoot a different (More Powerful) bullet.

I’ve seen that you can use “Get Input Key Time Down” to see how long the key is held and using some tutorials I found online I have a blueprint similar to those (Changed just enough to get it to do what I want)

Unfortunately it is not working. Whether the player just taps the key or holds it for 5 seconds it makes no difference.

Can anyone tell me how to get this working?

Use the Is Input Key Down with a delay to check…the delay amount is how long you want the player to hold the key before the “charged” event happens like this only use a higher value for the delay:

this is wrong. he does not need to fire on press key, only on release, so he can calculate the press time.

this is how I did it

needs a retriggerable delay there

Correction

It almost works. If you tap shoot it fires weak shots and if you hold it fires a strong shot however their is an issue.

If you tap shoot you will fire a weak shot. If you tap shoot again a second later you fire a strong shot regardless of whether you held fire or not

have you tried the second image I sent as a correction?

I tested it myself and works fine

I made a slight change to it now and it’s working.

The issue was that if you press the fire key it would start the retriggerable delay.
The if you released it immediately it fired and set the Boolean off.
However if you pressed and released within a second the retriggerable delay goes off after the bullet is fired setting the boolean back to on.

I made a change so that if you press fire and the boolean is already on it gets turned back off.

this one helped me

This is how I would do it.

I put the HeldButton bool after the branch to make sure it doesn’t invalidate the button being held for the appropriate amount of time.