Audio in unity

Hey! I have a character and an enemy. When the character it’s getting close to the enemy the character start to scream but it;s start to scrim when the character is out of enemy lookRadius and stop when it’s getting closer to him. Please Help Me!
Here is my Script:

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

public class script : MonoBehaviour
public float speed;
public Transform target;
public float lookRadius = 8f;
private Rigidbody2D rb;
public Animation gura;

// Start is called before the first frame update
void Start()
    rb = this.GetComponent<Rigidbody2D>();
    target = GameObject.FindGameObjectWithTag("Leg").GetComponent<Transform>();

// Update is called once per frame
void Update()
    float distance = Vector2.Distance(target.position, transform.position);
    if (distance <= lookRadius)
        GetComponent<RandomPatrol>().enabled = false;
        transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime);

    } else if (distance >= lookRadius)
        GetComponent<RandomPatrol>().enabled = true;

private void OnDrawGizmosSelected()
    Gizmos.color =;
    Gizmos.DrawWireSphere(transform.position, lookRadius);

private class GetComponent<T>


the audio is the only part that is not working? since the GetComponent method should be overriding unity GetComponent, yoou need to delete that whole method .

also the error is probably in that the audio is getting restarted every frame before it even starts playing sound you need to check if audiosource is playing but i cant help you witout see your audiomanager script but you will need to create a IsPlaying method in the audiosource script and check if its already playing before starting the audio