Sounds playing on whole map

Im having a problem with a sounds playing on whole map, i put my sounds as a child of local script in startercharacter scripts, im using remoteEvent to send the sound to the server but they are hearable from whole map, how can i fix this?

Could you provide your scripts here? We can’t really help you if you don’t provide any code snippets.

local remote = script:WaitForChild(“RemoteEvent”)
local soundFolder = script:WaitForChild(“Sounds”)
local swingSound1 = soundFolder:WaitForChild(“Swing”)

local script:
uis.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local data = {char = char, action = “Swing”, swingSound1 = swingSound1}
remote:FireServer(data)
end)

script:
remote.OnServerEvent:Connect(function(p,data)
if data.action == “Swing” then
delay(.3,function()
data.swingSound1:Play()
end)
end
end)

1 Like

So you want the sound to play locally or want the sound to only play if the player is close to the swing?

i want other players hear it when they are close to it

You can use the properties, Sound.RollOffMinDistance and Sound.RollOffMaxDistance.

i did but its still playing on whole map

but should i change it in the server script or just in sound?

Since, you want other people to hear the sound too when they are close, use server scripts if you want other people to hear it when they’re close. The sound should also be parented to somewhere else that’s handled on the server (e.g. Workspace, ServerStorage, a part).

can it be the parent of local script in the startercharacterscript or i need to parent it to character rootpart

Parenting the sound to the character can work. Both the script and sound need to be on the server based on what you want.

like:

Sound.Parent = character. -- R15 or R6?
Sound:Play()

do i need to parent sound or can it be folder with sounds?

oh okay it needs to be raw sound ty