I can't get the sound to play when its clicked

Screen Shot 2022-08-25 at 5.09.34 PM

where is the location of the sound

1.Is that a local/server script?
2.Try to play it before destroying the script’s parent.
3.Show us the location of that sound.

It is because you are destroying script.Parent so the script won’t run, try doing :Destroy() at the end of the connect function

the sound is inside of the workspace

remove the script.parent:destroy() line and see if it works

Define the sound before the function is called.

local sound = workspace.sound

Then just call sound:Play() in function.

1 Like

everytime i do that it says "sound is not a valid member of DataModel “Game” and its this kind of script
Screen Shot 2022-08-25 at 5.15.15 PM

do game.Workspace.Sound:Play()
(you can put the sound inside the script)

Do workspace.Sound:Play char limit

it still says "sound is not a valid member of DataModel “Game”

put the sound in the script and try to do script.Sound:Play()

Please provide your latest code.

You are trying to locate the Sound inside of the Game itself instead of the workspace.
Replace script.Parent.Parent.Parent.sound:Play() with workspace.sound:Play() and see if you still get an error.

2 Likes

I suggested that few posts ago.

1 Like

you miswrote Local, it must be local.

1 Like

Lol i was mobile, dang auto capitalize… nice catch!