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 4 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.

local sound = script.Parent.Handle.Sound
if sound.IsPlaying then
    wait(1)
    sound:Stop()
    sound:Play()
   else
    sound:Play()
end
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 — 4y
0
I'll try that. User#32819 0 — 4y
0
That still didn't work. User#32819 0 — 4y

1 answer

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

Try this.

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

Answer this question