Play Sound Gui more than one Button

Hi!, i have an dance gui every button haves different animations. So what i want is, for example i press Say so (Button31) button and it haves to play the song so it haves to put the song id in to Sound and play it. But if i click Dynamite button it haves to play the song that the Dynamite buttons Intvalue. When i click again dynamite button it haves to stop the music.

I really need it plss send me the full script. Not all the buttons just do 2 so i will understand how its going the script.

A button haves a IntValue the value is the song id. When the button is clicked the IntValue has to play the song id [Short explanation]

Schermafbeelding 2021-05-12 183600 Schermafbeelding 2021-05-12 183644

I think what u need is "IsPlaying " sound property
if it is playing then u just gotta stop it by sound:Stop()
(Not sure i’m new to lua)

i wrote this rough code not sure if it works but will be glad if it’s any helpful to you =]

	if script.Parent.Parent.Sound:IsPlaying() then
  -- place sound id inside the ssound somewhere here
1 Like

Please do not ask people to write scripts for you in Scripting Support, or on the Dev Forum for that matter. However, I would be happy to help you learn how to do said function! Here is a general overview of how to do what you are trying to achieve:

If you want to a textbutton to do something when it is clicked, you’re going to want to use the
textbutton.MouseButton1Click() function. Whenever the button is clicked, you need to check for a couple things using if statements:

  1. Is the song assigned to this button playing? If so, then stop the sound.
  2. Is another song playing? If so, then stop that song and play this one.
  3. Are no songs playing? If so, then play this song.

(If you do not want to write the script, you are welcome to commission someone on the dev forum)