I created a script in the StarterGui, and the parent of the script is a TextButton, and the parent of that is a ScreenGui, the screengui includes a Sound too. I am trying to make a button that when you click it it plays the song in the sound id. Although it's not working, this is the script of the TextButton. (It's a LocalScript)
Player = game.Players.LocalPlayer
Button = script.Parent
Song = script.Parent.Parent.Song
Playing = false
function PlaySong()
if (Playing == false) then
Song:Play()
Playing = true
elseif (Playing == true) then
Song:Stop()
Playing = false
end
end
Button.MouseButton1Down:connect(PlaySong)

2 comments
Could be a loading issue. Try preloading the song asset.
Oh and by the way, I forgot to say, it works when I test in ROBLOX Studio, but not in server