This script makes a gun fire sound play when I shoot.But the problem is, the sound stacks up and makes a horrible noise. I tried to add a wait(1) before stopping the sound and playing again but it didn't work.
1 | local sound = script.Parent.Handle.Sound |
2 | if sound.IsPlaying then |
3 | wait( 1 ) |
4 | sound:Stop() |
5 | sound:Play() |
6 | else |
7 | sound:Play() |
8 | end |
1 | local sound = script.Parent.Handle.Sound |
2 | if sound.IsPlaying = true () then |
3 | wait( 1 ) |
4 | sound:Stop() |
5 | wait( 0.5 ) |
6 | sound:Play() |
7 | else |
8 | sound:Play() |
Try this.