Sound from a players weapon can be heard by everyone in the server even when they're far away

Hello, i made a gun that reuses sounds, the issue I’m having with it, is that whenever i fire the weapon the sound gets added to a folder inside the tool “Handle” it plays the sound. But, for some reason, everyone can hear it like they’re the one firing it even if they’re like really far away from it.
i found a similar forum post like my issue but I’m not adding the sound under the script it’s parented to the part and in a folder that would hold it (to keep it neat and yes ofc i tried it without the folder and even parenting it under the tool itself the problem still happens)

-- this is when i fire the weapon
local Audio = getSound("HeavyGun")
Audio.Parent = Handle.WeaponAudio
Audio.Playing = true
	
delay(Audio.TimeLength,function()
	Audio.Playing = false
	Audio.Parent = game.ReplicatedStorage.bulletVisual.AudioHolder
end)

-- and this is a function i use to move the sound to the handle when it's needed 
function getSound(String)
	local SoundFolder = game.ReplicatedStorage.bulletVisual.AudioHolder
	if #SoundFolder:GetChildren() == 0 or not game.ReplicatedStorage.bulletVisual.AudioHolder:FindFirstChild(String) then
		local tracer = game.ReplicatedStorage.bulletVisual.BulletAudio:WaitForChild(String):Clone()
		return tracer
	else
		local tracer = game.ReplicatedStorage.bulletVisual.AudioHolder:WaitForChild(String)
		return tracer
	end
end
1 Like

Make a part welded to the weapon that has all the sounds inside of it. Remove the sounds from the folder and put them in this new part, then edit the script to play the sounds from that sound part.

1 Like

Have you edited the sound’s RollOffMaxDistance? It’s set to 10000 studs by default and that could make it seem like the sound is playing globally?
image

3 Likes

I think the issue is that they’re in a folder and aren’t parented to a part?
image

2 Likes

i tried it without the folder and just parented it to just the part and when that didn’t work i also tried to parent it to the tool itself

1 Like

Had the same issue when making a backup alarm for a vehicle, the sounds should in fact be parented to a part instead of a folder.

1 Like

A folder has no position located in the Workspace. From personal experience, a Sound uses RollOffMaxDistance and RollOffMinDistance only when its parent is a BasePart.

1 Like

ahh got it, it’s working now thanks!

1 Like