Yeah see both of those are directly connected to remote events. The first one take the musicID directly from the remote and plays it. Instead take a “request”. Then queue the request and make it wait to be played until the last one finishes or something. Depending on how you want all this function.
If the intention is for players to choose they music they listen to individually, then move the music playing code onto the client. Playing on the server plays for everyone, playing on the client will be just for that client.
Because your not queuing play requests. Any client can invoke the play function and start playing a sound. The previous sound isn’t over so multiple music plays at the same time. That last statement wasn’t true I see in your code you are stopping the previous sound. So its just a matter of players playing new sounds. But its possible that if the method is invoked at relatively the same time by 2+ clients multiple sounds get played at the same time.
I don’t think there is any exploitation happening exactly. You may just need a debounce. But if you don’t implement a queue clients will be stopping/playing new songs nearly constantly. Alot of the “Club” type games out there have a song play queue and also a downvote system. The down vote will cancel the current song if enough players don’t enjoy it.
Are you sure that “RespectFilteringEnabled” is enabled in SoundService? That was the solution to a similar problem I had a bit ago, and it took me a while to realize it.
If you can’t enable it then there will be no easy way to fight sound exploits. With RespectFilteringEnabled off in SoundService, anyone can make a sound anywhere in any instance of your game and control it completely clientside. Differentiating sounds by name wouldn’t be ideal either since if you made an anti-exploit that detects sounds by name, exploiters can just catch onto that and make adjustments.
Try to send calls to an event to handle gun sounds or something. That’ll be a good way to have the chance to enable the property in SoundService which as far as I can tell will solve your problem.