Playing sounds to every client correctly

  1. What do you want to achieve? I want to have sounds realistically replicate to all clients.

  2. What is the issue? I have a functioning system that replicates sounds, but it is not 3D, so if someone shoots at you from the right, it would not sound different from someone shooting from the left.

I am not at my computer currently, but it roughly looks like this.

Local


RemoteEvent:FireServer()

Server


RemoteEvent.OnServerEvent:Connect(function(

RemoteEvent:FireAllClients()

Sound:Play()

)

This was done to every sound I wanted replicated. There is likely another way to do this that is a lot better, which is why I am asking.

EDIT: I know I was vague, but I eventually found out it was because it was parent to a model, which can’t play sound in 3D, so I parented the sound to a part. Thank you for the responses.

1 Like

You may want to tweak the properties of the sound values for a more “realistic” play of sound.

Though, you’ve not given much to reply with, it’s the best advice I have.

If a sound is parented to an object, the sound plays from there. Using this feature, you can achieve what you want.

Im not sure but I think you can do (Server)

RemoteEvent.OnServerEvent:Connect(function(plr) 
	RemoteEvent:FireAlllClients()
	Sound.Parent = plr.Character.HumanoidRootPart
	Sound:Play()
end) 

I might be getting it wrong since not everything in the code you sent is very clear to me, like for example the :FireAllClients() part, or that you wrote the code in the brackets of the function where I though the “variables” such as the player go.
For my FPS game, I used a similar system that I sent here because I wanted to implement the player not being able to hear any sound while blinded by a stun grenade.

Note: if the FireAllClients part is there so that the clients can modify the sound (muffle, reverb, etc) client-sided (maybe even based on several factors such as distance, surrounding materials, etc.), then you should move that FireAllClients part to after Sound gets parented to the RootPart, and before the sound plays.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.