Replicating Sounds and Effects From Clients

I’m working on a fighting game with weapons, and attacks are initiated by the client for the sake of responsiveness by playing the required animations and firing events on certain keyframes, performing sanity checks on the server to prevent foul play when it comes to things like hit detection and hit rate.

I also want to tie sounds and effects to these keyframe events, but simply playing them on the client obviously wouldn’t replicate to everyone else. Firing a signal to ask the server to display these effects to other clients also seems like a bad idea, as this could be exploited by bad actors to cause immense stress on other clients.

Is there a way to sanity check something like this? Or should I take another approach to replicating sounds and effects from client animations?

1 Like

sonud effects dont have large effects on performance, if you’re really concerned about it, you could just use your remote and play the sound directly on the server rather than forcing other clients to play it

That is the point of server authoritative systems. If you have a remote that allows you to play sounds to every client for the sake of client-sided feedback without any server sanity checks, it’s client authoritative.

When you throw a punch, you obviously need to decrease their health somehow, something that is done through remotes. If that is properly secured, why not just send a signal to every other players with your server code? Obviously, there is a case to be made where invalid requests won’t trigger these sound effects but the animation will still play (either through exploiting or even perhaps lag), but who cares? They are dead requests anyways, so you shouldn’t really care about it too much.

Regarding your animations, animations that are loaded and played on the client to their own character are automatically replicated to other clients, but you should find a balance on which effects needs to be played. If you want to tie all player animations to sounds, more power to you. At the same time, you can also implement client “safety” features, such a rate limit on how often sounds should play coming from other clients if you’re worried about spamming.

For things like impacts and hit effects, these are already done on the server when everything checks out and is secured. What I mean is something like the sound and particles of a sword being swung, sending a signal just to replicate the sound and particles seems like a vulnerability, and ultimately redundant as well. My concern is placed on this as sounds and visuals play a large role in telegraphing certain attacks, so I want other players to receive them one way or another in order to be able to respond fairly.

When the event is fired to the server on keyframe events, just have the server fire to all clients to replicate the vfx and sfx. I don’t see any vulnerabilities here.

Make a local script named “Audio Listener” or whatever you think the name should be. After receiving the remote event on the server, fire another remote event back to all clients passing the audio id as a parameter, then play the audio on the client.

Note: I suggest just playing the audios on the server. Roblox processes them on the client anyways so performance won’t be impacted, and the audio will play at the location where the event is being fired, adding depth to the game. Up to you though, cheers!

If there’s no harm done just receiving signals to play sounds initiated by clients, then I suppose I’ll continue developing as such. I appreciate the feedback from everyone, I’ll be taking this insight forward with me.

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