Fence sound effect repeating as fence opens

Hello,

So I have a script here that gets a fence to open and I finally got it to work how I want it to… kind of. Now, I’m trying to implement a sound effect of a fence opening that I found in the audio library but whenever I click the button that opens the fence, as the fence opens it repeats the sound over and over. I’m not that experienced in scripting as how I’ve mentioned in the past on here but what should I edit from the script to make this sound stop repeating and only play once?

Video of what I’m talking about:

The model in workspace:
image

The script:


You have it where the sound plays in the for loop which repeats 60 times. Put it before the for loop.

1 Like