Audio won't play ingame

So I recently uploaded my own audio to my group and tried putting it in one of my games but it won’t play for some reason. They are just SFX so they aren’t copy righted, also work when I press preview in Workspace but won’t work when I make it so that they play when I click a button. How can I fix this?

1 Like

Show us the script that controls the button and also where do you have the sound parented?

2 Likes

if its a ui button then:

script.Parent.MouseButton1Click:Connect(function() 
script.Parent.SOUNDNAME:Play() 
end)

For a click detector use:

script.Parent.MouseClick:Connect(function() 
script.Parent.AUDIONAMEHERE:Play() 
end)

mouse button script is a local script and click detector script should be a server script.

Mark as solution if this helped!

1 Like
script.Parent.Activated:Connect(function()
	script.Parent.Parent.Exit:Play()
	script.Parent.Parent.Parent:Destroy()
end)

The sounds are parented under the ``MainFrame``` which is the parent of the buttons.

Try putting a print statement in after the activated function (and before the play) to see if the funtion is working when clicking the button… if its not printing then try @UItraEX solution.

1 Like

My script worked perfectly fine for other audios. I don’t know why it’s just these sounds that don’t work.

Ah the audio seems to be working now. It wasn’t a script problem or anything. I think it was just a bug

Edit: only one of the audio works and the other doesnt…

Maybe when u reuploaded it and it had a new id u didnt update it in script… if u have, try to reupload those audios.

I never reuploaded the audios. One of them worked by script and luckily enough the other sound was supposed to play when the button to destroy the UI was clicked so all I had to do was select PlayOnRemove.