I want to extend the duration of a powerup, can anyone help ?

Hello, is there a way to extend the duration of powerup if “player” picks it up twice?
Here is the code i use at this moment:

using UnityEngine;
using System.Collections;


    public class Powerup : MonoBehaviour
    {
        [SerializeField] GameObject effectPrefab;
        [SerializeField] float duration = 10f;
        [SerializeField] float amaunt = 2f;      
        private bool isActive = false;

        private float startduration;

        private void Start()
        {
            startduration = duration;
        }

        private void OnTriggerEnter(Collider other)
        {
            if (other.CompareTag("Player"))
            {

                StartCoroutine(StartPowerup(other));
            }
        }



        IEnumerator StartPowerup(Collider player)
        {
            isActive = true;
            GameObject effect = Instantiate(effectPrefab, transform.position, Quaternion.identity);
            Destroy(effect, 2f);
            if (isActive)
            {
                duration += startduration;
            }
            Health playerHealth = player.GetComponent<Health>();
            playerHealth.health *=amaunt;

            GetComponentInChildren<MeshRenderer>().enabled = false;
            GetComponent<Collider>().enabled = false;

            yield return new WaitForSeconds(duration);

            playerHealth.health /= amaunt;

            isActive = false;

            Destroy(this.gameObject);
        }
    }

Hello.

Man, did you understand your code? Its quite simple…

Just change the duration variable value… so the yield command will wait more seconds.

Bye.