function Fire_Gun() local FireSound = Handle:FindFirstChild("FireSound") local Bullet = Handle:FindFirstChild("Bullet") if FireSound then FireSound:Play() end wait(0.2) -- if i add a wait here it won't work, because the gun can fire only every 0.2 seconds so no if Bullet then Bullet:Play() end
So the prob i got is, the sound when gun's fired it plays FireSound and bullet, but if the gun fires like 1000 bullets per minute it's very hard to hear or u just don't hear it. Also the bullet sound sometimes plays first rather than firesound
Fire sound always needs to be first and bullet sounds play like 0.2 seconds later but it fails, how can i make it hear when the weapon fires very fast ?
Also, is there a way to run the whole script but make 1 line wait ? Hope you understand what i mean :)
Please, don't change the script it's fine just explain what's wrong :D
Well sound length is a lot more than .2 seconds. Only solution here is adjust time position in sound or increase the pitch. Or you can do this:
-- every time you shoot create a new sound: if FireSound then local ss = Instance.new('Sound') --shoot sound ss.SoundId = 'SoundID' ss.Volume = 1 ss.Pitch = 1 ss:Play() ss.Parent = script.Parent wait(length of sound) ss:remove() end
You need experiment with that! However gun probably will shoot every ' wait(length of sound)'.
In that case you can create another script. Remove the ss:remove() from script above.
while wait(5) do local sounds = script.Parent:GetChildren() for i= 1,#sounds do if sounds[i].ClassName == '(check the sound class name, i forgot :D)' then sounds[i]:remove() end end end
This will solve the case!