How to make script.Parent.FocusLost:Connect(function() work on a script?
Asked by
4 years ago Edited 4 years ago
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?
1 | script.Parent.FocusLost:Connect( function () |
2 | local text = script.Parent.Text |
3 | workspace.speakers.speaker.Sound.SoundId = "rbxassetid://" ..text |
4 | workspace.speakers.speaker 2. Sound.SoundId = "rbxassetid://" ..text |
5 | workspace.speakers.speaker.Sound:Play() |
6 | workspace.speakers.speaker 2. Sound:Play() |