how to pass an audio clip to an audio source using c#

i am trying to get unity to play a sound but i cant get my script to pass clip to the sound source. the script sees it but can’t pass it, or play the sound.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;

public class makeanoise : MonoBehaviour
{
    public AudioClip hurtSound;
    public AudioSource soundSource;

    private void Update()
    {

        if (!soundSource.isPlaying)
        {
            soundSource.clip = hurtSound;
            soundSource.Play();
        }
    }
}

soundSource.PlayOneShot(hurtSound);

do not do this in update function…