Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make gun fire sound not stack if I fire it non-stop?

Asked by 5 years ago

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.

1local sound = script.Parent.Handle.Sound
2if sound.IsPlaying then
3    wait(1)
4    sound:Stop()
5    sound:Play()
6   else
7    sound:Play()
8end
0
Maybe make the sound play as the gun shoots and before the next bullet appears you just stop the sound. That is of course if your gun has any kind of delay between shots. bostaffmanbulgaria1 89 — 5y
0
I'll try that. User#32819 0 — 5y
0
That still didn't work. User#32819 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
1local sound = script.Parent.Handle.Sound
2if sound.IsPlaying = true() then
3    wait(1)
4    sound:Stop()
5    wait(0.5)
6    sound:Play()
7else
8    sound:Play()

Try this.

0
Didn't work. User#32819 0 — 5y
Ad

Answer this question