How do I make this sound play from ServerStorage?

I’m trying to keep all of my sounds for my game inside of a folder in ServerStorage so that I can easily update and change them as I update my game, however I can’t seem to get sounds to play while they’re there.

I was able to play a sound while it was in workspace, however it won’t play while in serverstorage for some reason.

Here is my sound script

sound = game.ServerStorage.DoorSounds.HingeDoor1.Buzzer

To play the sound I just use sound:Play(), again this setup worked while the sound was in workspace, but not anymore.

How should I go about doing this?

1 Like

Everything inside server storage can only be seen by the server(unless you store objects inside server storage from the client), so you’re technically playing the sounds on the server. You must place sounds inside containers like PlayerGui so the sounds can actually be played on the client.

1 Like

You could define the sound in a variable (Currently What you have)
Move it to the workspace then Play it
Once it finishes move it back to ServerStorage
Example Code:

local sound = game.ServerStorage.DoorSounds.HingeDoor1.Buzzer
sound.Parent = game.Workspace
sound:Play()
wait()
sound:Stop()
sound.Parent = game.ServerStorage

As long as nothing else tries to find the sound in ServerStorage it should work. If you need a script to find the sound while it’s in the workspace, then just do,

game.Workspace.soundname

Hope this helps! :grin:

3 Likes

It’s called ServerStorage for a reason. Items in a storage are meant to be taken out and used, not used from the storage itself. Any object that’s placed there is static.

ServerStorage doesn’t have any 3D space representation, nor would playback replicate if the object isn’t replicated to the client. The client actually needs to be able to see the object and access sound data to perform playback.

Technical stuff aside, canonically you should not be trying to play sounds from a storage service.

2 Likes

I would also suggest re-considering the location of the folder. ServerStorage can’t be seen by clients so you could move it to Lighting and it may play there.

First it depends on what place is triggering the event to play the sound, and where you want the sound to be played. If it’s in the player, as in a player script from the StarterPlayerScripts (I assume, I know StarterGui Gui copies over to the player), then you can use that script to clone the sound from the ServerStorage, and then Parent is to the Player, and then use that script to play it. The player will be the only one who can hear it then.

But if you are playing the sound in the world, then you would clone the sound, parent it to the part, and then play the sound. That will have people in range of the sound hearing it (I assume).

If you want all players to hear it like a “Player Added” sound that announces to everyone that the player has been added, it’s probably a good idea to have a control script send a message to all the players. and then have it cause all the player scripts to clone the sound to the player and play the sound.

I’m 99% sure that’s how this works.

I am currently cloning my NPCs and Core scripts and Accessories from Server Storage and it’s the exact same process for all of them. Additionally, I have been playing walk and attack animations the same way.