Sound doesn't get played, no errors in the Output

Hello, I have made a script which is simple, when the TextButton gets clicked another UI appears and a sound is meant to be played. I have done the UI appearing part, but for some reason the sound doesn’t get played at all. The output is empty, it doesn’t show any errors. I have checked my audio devices and they are all fine, I can hear the walking in game, jumping etc.
Script:

TeleportService = game:GetService(“TeleportService”)

script.Parent.MouseButton1Down:Connect(function()
game:GetService(“TeleportService”):Teleport(6800475728)
script.SoundEffect:Play()
end)

The script in Explorer:
Screenshot_475

Link to the sound effect:

I believe that you need to put “SoundEffect” under “Workspace” for it to work.

I have tried that right now, nothing changes. There is again no error in the output, but still, I clearly can’t hear it.

I believe the issue may be that you’re playing the audio after the player is teleported from the game. Try switching the order and put the :Play() before the :Teleport().

Also, you do not need to declare TeleportService = game:GetService(“TeleportService”) twice, you can simply put local TeleportService = game:GetService(“TeleportService”) and use TeleportService:Teleport(6800475728) as “TeleportService” was declared as a variable.

2 Likes

You don’t need to have the sound in the Workspace to play it; it still works in StarterGui.

2 Likes
  • Check the volume
  • Try placing the line of code that plays the sound above the teleport function
  • Check the output for any errors in your code that might prevent the sound from playing

Hope that one of these will help you out.

1 Like

Try taking the sound out of the script and play it.

1 Like