Play sound locally while it's inside part

Hello, so my sound is inside the part. I want to play it locally once the player touches the part, but the thing it’s playing sound server-sided because the part located in workspace even when it’s a local script. Is there any way to fix it ? (The sound must play from part)

its not possible for it to be playing on the server from a local script, can you share the script?

If everyone is hearing the sound playing, it’s not because of a Sound:Play() call in a LocalScript. One of the following is likely true:

  1. The Sound is serialized in the place file with the Playing already checked (true)
  2. Your script is not a LocalScript, but a Script with RunContext of Client, and it has detection code that is running on all clients and independently playing the sound when touched (on all clients).
  3. There is some server code playing the sound.

If you call Sound:Play() from a true LocalScript, the result will not replicate to server or any other clients, only the local player will hear it.

Maybe make sure the sound is inside the part? But if its in a local script it SHOULD only play locally for the client

the only way this is possible if it is actually a localscript is if RespectFilteringEnabled was turned off in SoundService

1 Like

I’m curious in how you’re running a localscript to play for the player, but it plays for everyone.

technically, it is not possible to do so, otherwise you’d see frequent exploits in every games that would abuse it.

The only self-modification that does replicate with the server’s permission is usually your own’s character animations and joint modifications

Ugh, you’re not wrong. At this point, I wonder if this property should even still be visible. Unchecking RespectFilteringEnabled is just inviting people to use obnoxious sound exploits in your game, and honestly no one should uncheck this in new games; it was only meant for backwards compatibility in very old (pre-2017) games that had pre-FilteringEnabled sound scripts. If the OP did uncheck this, and it’s the source of the problem, the best option is to re-check the box and if you need sounds to play for all users, make the Sound:Play() call on the server or from a Script with RunContext Client (whichever is appropriate for the condition that triggers the sound; understanding that a RemoteEvent might also be necessary in certain cases).

1 Like

Enable filtering enabled in sound service SoundService | Documentation - Roblox Creator Hub

Hello, I want to thank everyone who tried to help. I fixed the issue. My script checks if the object that touched the part is a player, not necessarily the local player. So, if player 2 touches it, it will trigger the event for player 1 because the script only checks if any player stepped on it, not if player 1 was the one who stepped on it. After performing the character check, I retrieve the player from the character and compare it with the local player.

yeah, it seems pretty counterintuitive. I can’t think of a single scenario where this would ever need to be turned off anyway, and if you turn it off to get around using remote events, then that’s just questionable…

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