Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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:

01local serverTold = false
02local MusicList = {}
03local PaidToPlay = {}
04local PaidPlayer = {}
05 
06function playSong()
07    game.Workspace:WaitForChild("SoroSound"):Stop()
08    wait()
09    if #PaidToPlay == 0 then
10        toPlay = MusicList[math.random(1,#MusicList)]
11        playerWhoPlayed = "Server"
12    else
13        toPlay = PaidToPlay[1]
14        playerWhoPlayed = PaidPlayer[1]
15        table.remove(PaidToPlay,1)
View all 36 lines...

Client-Handle:

01game.ReplicatedStorage.updateUI.OnClientEvent:connect(function(SongName, playedby)
02    game.Players.LocalPlayer.PlayerGui.SorosUI.Music.Current.Text = "Now Playing: "..SongName.." (Played by "..playedby..")"
03end)
04 
05game.ReplicatedStorage.purchasedSong.OnClientEvent:connect(function()
06    script.Parent.SorosUI.GUIs.chooseSong:TweenPosition(UDim2.new(0.5,-150,0.5,-100),"In",0,0.2)
07end)
08 
09local song = game.Workspace:WaitForChild("SoroSound")
10 
11song.Ended:connect(function()
12    game.Lighting.songEnded:FireServer()
13end)

1 answer

Log in to vote
0
Answered by 8 years ago

Figured a fix - just gonna handle everything on the server. :)

Ad

Answer this question