The problem: I'm making a speaker system for a game, and a common problem is that the sound is not loaded right away whenever you try to play it. This results in different speakers starting to play at different times, or, to paraphrase, the sounds are out of sync. My solution is to add a 'sync' button that resets the sound id in the speakers, making them re-play the sound, but at the same time. Once I thought I had finished, I tested it in Play Solo and it worked just fine. A day or so later, I tried to use it in the actual game and found out that it simply broke the sound system so you couldn't change the sound id. For some strange reason, the button only works in Play Solo mode.
Background information: I engineered the sound system so you could add as many speakers as you wanted, and they would all be connected. To do this, I made the speakers connect to a NumberValue in the DJ table. Whenever a user enters a SoundId, the NumberValue adjusts to the ID number. The speakers use the Changed event to check whenever the NumberValue is changed, and when it does, they then concatenate the ID into proper Asset syntax.
The code:
--This part works fine in Online mode. function TextChange() if script.Parent.Parent.PSID.Value ~= "" then Display.Text = "" script.Parent.Parent.Parent.Parent.SID.Value = tonumber(script.Parent.Parent.PSID.Value) script.Parent.Parent.PSID.Value = "" --Below is the first line of the broken code. else TemporaryValue = script.Parent.Parent.Parent.Parent.SID.Value script.Parent.Parent.Parent.Parent.SID.Value = 0 --Too lazy to create a local value for it... script.Parent.Parent.Parent.Parent.SID.Value = TemporaryValue --Still too lazy... --End of the broken code above. end end script.Parent.MouseButton1Click:connect(TextChange)
NOTE: The hierarchy is correct. I checked.
Sometimes if scripts are too long in Studio for GUIs they only work in Play Solo. It happened to me. All I did was put certain parts of the script in different scripts.