So I want to play a gun fire audio clip and for the user to not experience a latency, I want to play the audio locally and the trigger the server to play the same audio clip to every other client except the original client.
I am currently using RemoteEvent to do this but if I’m firing a gun which has a fire rate, I think this method might be using up the bandwidth too much.
You could immediately fire the RemoteEvent again for all clients, and then all the clients would then play it locally too. The trick is to make sure to pass the original player as an argument too, so that the original player avoids playing it twice.
You can, instead of using sound:Play() on the server, instead fire a RemoteEvent with the sound as an argument to all clients except the player who fired the gun to play the sound.
Just put the sound in a part inside the character of the client and call :Play() on it whenever you want to play the sound. There won’t be any delay for the player and everyone else will hear it too.
As much as I want to use this method, problem is that lets say that my gun fires a huge amount of shots per second. That would be too much data sending between networks.
Yeah, basically, I want the client to hear the audio play without latency to give 0 ping illusion effect while the other clients hearing it a little late is fine.
Have all sounds for guns connected to a SoundGroup for each player. In a LocalScript, mute the LocalPlayer’s respective SoundGroup. Play the client sounds not with the SoundGroup. Play the server sounds in the SoundGroup.
??? I don’t understand, doing :Play() on the sound which is in your character would play immediately on the client and it would also play for other clients.
That’s not a big problem, I’ve never had RespectFilteringEnabled in any of my games and never ran into anyone spamming sounds like that, nor got any complaints about anyone doing that.
There are scripts everywhere on it, and they’re extremely short. Just because nobody has done it to your game doesn’t mean it’s not an issue when it happens. Keep it safe, just use RespectFilteringEnabled.
By playing the sound on the server, you’re still sending the same amount of data to every client, just in a different way. If you play the sounds locally using the RemoteEvent method, it should be perfectly fine!
Doing Sound:Play() will play the sound globally if you don’t have RespectFE on like that dude said, don’t worry about exploiters they can’t do much with Sound anyways.
I finally decided on playing them through remotes either way as the sound has to be cloned by the client so I no matter RespectFilteringEnabled on or off, I have to go through remotes.