How to increase an object's animation speed based on the speed of what the player clicks/taps onscreen

Hey guys!

I’m extremely new to Unity and was wondering if anyone could share their knowledge as to how I would go about increasing/decreasing an objects animation speed and it’s actual movement speed based on the speed that the player clicks/tap on screen? If no clicking/tapping is detected the object would move on a set default speed.

Example would be: if no clicks/taps are detected player movement speed would be 1 m/s. 3 clicks/taps a second would increase the speed by lets say 2 m/s, while clicking/tapping 5 times a second would increase the speed to 4 m/s and so on.

note that this script will change the overall time scale in your whole project, but I think that will help you

using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class HeadHit : MonoBehaviour {
    
    	public float speedIncreaseAmount = 0.1f; //you can change that in the inspector.
    
    	void Update () {
    		if (Input.GetButtonDown ("Fire1")) {
    			Time.timeScale += speedIncreaseAmount; //if player tapped, increase overall timeScale by speedIncreaseAmont.
    	}
    }