Playing Audio clip in loop

I need to play a sound while an elevator is moving between floors. The elevators is activated by a if condition if(elevatorheight < or > floorHeight). The sound is playing but is not looping. It seems that the sound is being played a lot of times.

What is the problem?

check the loop box in the audio source.

You need to add another variable that tracks if you already made the audio Play(), and create another if statement. Otherwise, the clip starts playing again every frame.