I have made a system which announces the title of a song out of a list of five randomly selected songs. What I’m having trouble with is designing this system around a previous system that I have in place, which plays a user-submitted song and announces it’s title on the server. Both systems almost work fine together, but whenever a user submitted song is submitted and then ends or is stopped by the original submitter, the system which announces the current song that is playing announces the title of the first song ever played on the server instead of the current song. This bug is purely visual, the songs still play normally.
Here are the respective scripts for the client/server. I didn’t include the script which plays the user-submitted song because I am almost certain that this is not where the issue lies.
Server Script:
Client Script:
I need help figuring out how to play the current song after the song submitted by the client finishes or stops. I’m sorry if this post is a little hard to read, as I’m very tired right now. Thank you.
First of all, having an event for each songs isn’t a good idea. Instead, you could just use one. Example:
local SongEvent = game.ReplicatedStorage.SongEvent
SongEvent:FireAllClient("YOUR SONG NAME HERE!!") -- In your script, you're firing the Remote to all clients (players) with no arguments.
In a local script:
local SongEvent = game.ReplicatedStorage.SongEvent
SongEvent.OnClientEvent:Connect(function(SongName)
songInfoGui.Text = SongName
end)
I had one remote before, but it still wasn’t working so it got to the point where I was just trying random stuff (having multiple remotes) to see if it works. Thank you for your answer, I’ll try your script.