Music Gui Playing Issue

I tried making a click button to play music but it doesn’t work here is my script

–Variables
local GoodSound = game.SoundService.GoodSound
local play = false

–script
script.Parent.MouseButton1Click:Connect(function()
if play then
GoodSound.Volume = 1
play = false
script.Parent.Text = “Mute music” else
GoodSound.Volume = 0
play = true
script.Parent.Text = “Play music”
end
end)

Try this in a local script inside your imagebutton inside your GUI, under StarterGUI:

local music = game.SoundService.GoodSound

script.Parent.MouseButton1Click:Connect(function()

	if music.Volume == 0 then
		
		music.Volume = 2
		script.Parent.Text = “Play music”
	else
		music.Volume = 0
		script.Parent.Text = “Mute music”
	end
end)


If you want the music to not start right away, but be silent and only start when you click the button, then adjust “if then, else” statement accordingly.

This didn’t work the output doesn’t say anything

set ur volume to 2 or edit the script

I dont have a image button its a text button

The sound should have the Playing property disabled.

Show properties of your sound please and also a screenshot of your StarterGui hierarchy.

the volume is turned off

explorer

This Music GUI is in StarterGUI? And this script is a local script inside the Play button?

Yes the music gui is in startergui and the local script is in the button named play

And your Sound file is called GoodSound and located inside SoundService?

Yes its in soundservice i dont know why it dont work

how about this property… is it unchecked?

yes its unchecked from playing because I don’t want it to play on its own

There is no fault with the script I use it in my game.

Im thinking its your GUI.

Yes its made by the official Roblox account

How is it the gui the way its setup

Maybe… above the Music frame, what do you have it within?

The icon for the Music GUI looks like a frame, not a Screen GUI.

explorer
its inside this lot
Inside boogles frame then in a frame named music then the play button

Does the rest of the GUI work as intended?