So I'm scripting an automatic gun and I have a repeat loop used for firing bullets. Every time this loops, I play the gunfire sound. The problem is that when the sound loops, the new gunshot cuts off the old gunshot (just like replaying the audio file). I'm wondering how to make it so that it doesn't replay the audio and instead the gunshots don't affect one another. I thought of making 2 sound Instances and interchanging them and it works but I'm not sure that is the best way to go about this.
local sound = tool:WaitForChild("Gunfire") repeat sound:Play() ... ... until shooting == false
What should I do?
I had the same problem a while back, I figured out for me it was just the audio. You need to make sure its just the right time, not too long, but not too short. I'm pretty sure its your audio not your script. Hopefully this helps!????-Mrmonkeyman120
Well you can try going to the sound in the explorer, and checking the length, then cutting it off where you desire like so
(say the sound is somehow exactly 2 seconds long but to make it sound better I want it to stop at 1.2)
local sound = tool:WaitForChild("Gunfire") repeat sound:Play() wait(1.2) sound.Playing = false -- this could be == false instead ... ... until shooting == false
NVM, I found that I could just create a new sound instance every time in the loop, play it and destroy it.