Help needed on button mash meter!

I want the meter to be sorta like a pump mechanic. The faster the player presses “Q”, the faster the bar fills and the longer they take to press “Q” the faster it decrease the bar length.

My set-up is that the bar x scale increases every-time the player presses “Q”, but I’m confused on how to decrease the bar x scale based on the time that has passed without the player pressing “Q” and based off the current length of the bar from the player pressing “Q”.

I’m not sure if this is a good way to make a mash meter (Security aside since that isn’t important).

I’ve already looked on the forums for anyone else who was trying to create a mash meter like this and haven’t found much. I’m not sure if it’s easy to create or nobody bothers with it. However this is me trying to attempt it and any help will be greatly appreciated.

You can probably use tick(), check how many seconds it took to pump again and then add it to your x scale, but also use clamp so that it doesn’t go below minimum.

I’m not fully familiar with tick() and math.clamp. I know tick() is used for time and I think math.clamp is a maximum and minimum number, but I’m not sure how to incorporate it together.

Edit: I don’t know how to incorporate them together to work with the meter