What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Nil
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Really basic local script example:
while wait() do
local p = game.Players.LocalPlayer
if isFire == true then
if isDown then
if db == false then
db = true
script.Parent.RemoteEvent:FireServer()
wait(0.1)
db = false
end
end
end
end
Could be that the wait(0.1) statement is too short, causing the sound to start playing again, before the first sound has finished. Can you try increasing the wait to like .5? Also, you may want to check the length of the sound.
Ok I see – so you want the gun to fire every 0.1s. Do you know if the sound clip is 0.1s (or less?) At the end of the video, I can hear a “whoosh” sound for the end of the sound clip. I’m guessing the sound clip is longer than 0.1s.
You could check Fire.TimeLength to see if it’s longer than 0.1s. Alternatively, could find another clip that’s shorter than 0.1s. I couldn’t find anything about playing the clip at faster speed.?
Although I advise against using this solution for performance purposes, you could clone your gunshot sound every time you fire it, set PlayOnRemove to true, and destroy the clone.
Another thing, because you are playing the sound solely on the server, there will be server-client lag, thus the gunshots might sound off at times. I suggest you use a RemoteEvent to FireAllClients to play the sound locally.
It varies depending on the strength of each clients computers, but in general, it is a good practice to do such things on the client instead of the server.