The Parent is an imagebutton. I tried to make it change it’s image id but that doesn’t work either. The song doesn’t continue to play. I don’t understand where the error is.
Inside the the ImageButton there is a Sound, UICorner and the localscript:
script.Parent.Sound:Play()
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Sound.IsPlaying then
script.Parent.Sound.Volume = 0
script.Parent.Image = 6853258454
else
script.Parent.Sound.Volume = 0.5
script.Parent.Image = 257126515
end
end)```
script.Parent.Sound.IsPlaying will always be true here even when you set the volume to 0 therefore the code inside the else bit will never run.
Instead of setting the volume to 0, you should just set Sound.Playing to false when you want to pause the sound, this will change the Sound.IsPlaying variable.
script.Parent.Sound:Play()
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Sound.IsPlaying then
script.Parent.Sound.Playing = false
script.Parent.Image = 6853258454
else
script.Parent.Sound.Playing = true
script.Parent.Image = 257126515
end
end)