I'm working a Speaker Gui that makes you change the music. I know some code but when I try to use script.Parent.FocusLost:Connect(function() on a script it doesn't work. But when I put it in a localscript, it works, but, the song only plays on the players side that has the gui. How do I make it so that it can work on a script? or find a alternative?

script.Parent.FocusLost:Connect(function()
	local text = script.Parent.Text
    workspace.speakers.speaker.Sound.SoundId = "rbxassetid://"..text
    workspace.speakers.speaker2.Sound.SoundId = "rbxassetid://"..text
    workspace.speakers.speaker.Sound:Play()
    workspace.speakers.speaker2.Sound:Play()
end)

1 comment