Problem with sound

Hello there,

I have recently tried to work on the sounds of my game and one of the problems I am facing is that even when there is only 1 instance of a sound in the game the audio duplicates to both the server and the player and plays twice.

I had searched about this problem on the forms and one of the solutions I got was to tick the Playing property to false and enable the sound through a local script with the following.

script.Parent:Play() -- The sound starts as soon as the player joins

But then the other problem I have started to face is that when I try to pause the music from another script, it stops the sound from playing on the local server but the sound on the server keeps playing.

Help would be appreciated!

1 Like

the sound turning off on local is probably because you used a local script, there’s not much information here, what script did you use to play the sound and where did you put it

I used a local script to play, The scripts is under the sound item and plays as soon as a player joins.

If the sound is locally played, I suggest parenting said sound instance to the PlayerGui

Alr will try that. (Char limit)

Its still the same exact problem.

Local Scripts are only parented for Clients to be used.
If you’re trying to understand how to mute the server itself you can use Remote-Events.

Although I do recommend if you want an easier way, please let the Client play the Music, Server Music when trying to be muted only will work for the client and not the Server. Client’s are more reduced to using anything server sided without a proper function call from a Remote or Firing a Remote Event.

I have an area through which players can listen to the songs they want withought changing songs for everyone else in the game. So it is important for the music to be played client sided.

Interesting, so you’re trying to detect those in a box with sound, which means you need a Local Script to detect the Client thats in a ‘region’ with different audio to play from being in the Box?

Not exactly, Basically each player has a sound instance with them which should be controlled locally. Its not dependent on any region, Its the player’s choice to listen to what they want, but withought changing the sound for everyone. The part about changing the song into a new one works perfectly fine, but because the sound instance doubles (I have a default sound which starts as soon as the player joins) as a player changes a sound locally the server sound remains the same and when they both combine its not something you’d wanna hear.

Just create the sound on the client, don’t have any sound server-side. If you don’t want to create the sound instance with code, just put the default one in ReplicatedStorage and in your sound controller localScript, move the sound from replicatedStorage to playerGui and play it.

If possible it would much appreciated if you could provide screenshots of the issue and the layout of the sound (parent, children, etc)

The sound is on the local side, but when the server starts the instance duplicates and one instance is formed in server as well.

The location is under starter GUI:

The script is:

There’s a chance the issue is that the sound is replicating to the client and playing that way, and also staying in StarterGui and playing there. The solution is to not have the sound instance in StarterGui. Create the sound instance in the script using This may not be the problem however, as I don’t think scripts run in StarterGui. It could be possible though.

It’s most likely something your script is doing to duplicate the sound, rather than the sound being replicated across the client-server boundary the way you describe it.

I’ll try creating the sound instance from a script, I’ll let you know of the results.

Sorry for the late reply, Creating the sound from a local script also is just the same. I think the problem is that when the server side creates its Gui the instance is being created there also.

You can have a look here where the sound plays but the instance isnt created. Let me know if I am doing something wrong.

Instead of doing script.Parent:Play() which when a server starts would start the instance playing on the cloned server I had to just do game.StarterGui.MainSound:Play() so it would do it just locally.