Annoying Client to Server bug...Help?
Asked by
8 years ago Edited 8 years ago
I have made a Music System for a ROBLOX group I develop in but cannot for the life of my figure out why some times it just decides to.. stop working.
The system plays songs in our trello until someone pays for a song which is added to the 'PaidToPlay' list and is played next.
Help?
No errors are printed in studio when the sound stops.
I've cut out parts which aren't required - to stop this being used elsewhere.
Server-Side:
01 | local serverTold = false |
07 | game.Workspace:WaitForChild( "SoroSound" ):Stop() |
09 | if #PaidToPlay = = 0 then |
10 | toPlay = MusicList [ math.random( 1 ,#MusicList) ] |
11 | playerWhoPlayed = "Server" |
13 | toPlay = PaidToPlay [ 1 ] |
14 | playerWhoPlayed = PaidPlayer [ 1 ] |
15 | table.remove(PaidToPlay, 1 ) |
16 | table.remove(PaidPlayer, 1 ) |
21 | game.Workspace.SoroSound:Play() |
22 | game.ReplicatedStorage.updateUI:FireAllClients(game:service( 'MarketplaceService' ):GetProductInfo(toPlay).Name,playerWhoPlayed) |
26 | game.Lighting.songEnded.OnServerEvent:connect( function () |
27 | if serverTold = = true then |
Client-Handle:
01 | game.ReplicatedStorage.updateUI.OnClientEvent:connect( function (SongName, playedby) |
02 | game.Players.LocalPlayer.PlayerGui.SorosUI.Music.Current.Text = "Now Playing: " ..SongName.. " (Played by " ..playedby.. ")" |
05 | game.ReplicatedStorage.purchasedSong.OnClientEvent:connect( function () |
06 | script.Parent.SorosUI.GUIs.chooseSong:TweenPosition(UDim 2. new( 0.5 ,- 150 , 0.5 ,- 100 ), "In" , 0 , 0.2 ) |
09 | local song = game.Workspace:WaitForChild( "SoroSound" ) |
11 | song.Ended:connect( function () |
12 | game.Lighting.songEnded:FireServer() |