Music doesn't delay by 10 seconds

task.wait(10)

script.Music:Play()

I have made this script that’s supposed to delay an music by 10 seconds but it doesn’t work somewhy? (I apologize I’m not the best at scripting)

1 Like

Not enough information, let me see the whole script.

3 Likes

Hi there could you possibly help with my post?

This is the whole script

wait (10)
game.Workspace.Sound:Play()

And in workspace theres a sound with an sound id inside it

Hello

Try to change that task.wait(10) to wait(10)
And make sure that there are not any other scripts that are making that sound play.
If you use a server script to play a sound you have to use a server script to stop it. A local script wont work.
Same thing applies to the local scripts as well. If you play your sound with a local script, you have to stop it with a local script. a Server script won’t work

1 Like

Hey

I changed task.wait(10) to wait(10)
But It still doesn’t seem to work.
It’s an script not a localscript

wait(10)

script.Music:Play()

And this is the current script

Is Sound.Playing set to false in edit mode?

Also you’d still want to use task.wait over wait

is the script run context set to server or client?
if the script run context is server or legacy try setting it to client
studio isn’t opening for me so I can’t test anything

I changed it to client it still doesn’t work and also is the sound parent supposed to be the script?

try moving the sound to the workspace
make sure that the “Loaded” is checked on properties of the sound

i moved the sound to workspace and checked the loaded it still doesn’t work

Check the permissions because weirdly enough theres a bug where public audio on the toolbox doesn’t grant permission

you mean the game settings and security?

No, there should be a little tab in view (i think) that has a name like “Sound Permissions”, or alternatively you can open up Output and check to see if it says anything about permissions

also i probably forgot to mention it but the sound plays when i join the game but it doesnt delay

Try parenting the sound to Workspace

doesn’t work im so sad i have like tried everything but it doesnt work

I’m not sure if LocalScript still run when parented to the workspace, but you can try inserting a regular Script and changing its RunContext property to Client.

Possible Solutions

Script Location (Most Common Mistake)
If your using a LocalScript put it in : StarterGui, StarterPlayerScripts, or StarterBackpack. Otherwise if your using a Script put it in : Workspace or A Descendant of Workspace, ServerScriptServer, StarterCharacter.

Audio not usable
Sometimes your audio isn’t playing because your experience is not validated to use that audio. Check for any errors with the same SoundID in the Output Tab.

Audio Location
The audio should be in a location where its heard from any position, like the Workspace or StarterGui.

Audio Properties & External Settings
Make sure that :

  • The audio being played is audible, check its volume, also make sure that your computer is not muted and the volume is high enough to hear it, maybe your Bluetooth is connected to your headphones an you don’t know?
  • Is the IsLoaded (Read Only) property ticked? If not this means your audio cannot e played because of its SoundID or it hasn’t loaded yet; try restarting studio.
  • Make sure the RollOffMaxDistance and RollOffMode are on the default settings to validate.
  • Make sure the PlaybackSpeed isn’t on 0

Is this on a server script? I find that sounds are buggy when it’s playing server-side.