How do I turn this into a Lerp function

So I’m busy with a project and we’re starting to work out thr rough edges, so we figured a slow over time would be better, the problem is I don’t really know how to turn this into a Lerp function, any help? Here’s the code,

using UnityEngine;
    using System.Collections;
    public class SlowWall : MonoBehaviour {
    	public GameObject Player;
    	private ScoreSystem scoreSystem;
    	void Start (){
    		Player = GameObject.Find("Player");
    		scoreSystem = (ScoreSystem)FindObjectOfType(typeof(ScoreSystem));
    	public float ShrunkenSlowDownPercentage = 0.6f;
    	public float SlowDownPercentage = 0.8f;
    	public float EnlargedSlowDownPercentage = 0.9f;
    	void OnTriggerEnter(Collider other)
    		PlayerComponent playerComponent = other.gameObject.GetComponent<PlayerComponent> ();
    		//checking if collided with player
    		if (playerComponent && !scoreSystem.GetOverload()) {
                if (playerComponent.transform.localScale.magnitude < 0.9f) {
    				playerComponent.Speed *= ShrunkenSlowDownPercentage;
                if (playerComponent.transform.localScale.magnitude > 1.9f) {
    				playerComponent.Speed *= EnlargedSlowDownPercentage;
    				playerComponent.Speed *= SlowDownPercentage;

I think it’d be easier to work with the else function for the example since that’s much less complex.

I think it is easier if you put the lerping into the part of the code that reads out the property “PlayerComponent.Speed”.

Or let me rephrase that:

Add another variable “SpeedTarget” into PlayerComponent. Instead of setting “Speed”, you set “SpeedTarget”. Then put an Update() - function into PlayerComponent that lerps the Speed towards SpeedTarget every frame. Done.

class PlayerComponent : MonoBehaviour {
    [System.NonSerialized] public float SpeedTarget; // change this instead of Speed
    [SerializeField] private float Speed; // don't change it from other places

    public float SpeedSmoothiness = 5; // play around a bit to find nice values

    void Awake() {
        SpeedTarget = Speed;
    void Update() {
        Speed = Mathf.Lerp(Speed, SpeedTarget, SpeedSmoothiness * Time.deltaTime);

class SlowWall : MonoBehaviour {
    playerComponent.SpeedTarget *= ShrunkenSlowDownPercentage;