The script works fine for when the first player joins and starts the server (playing the music and showing the song name) but when another player joins, it just plays the music and doesn't show the song name for them until it switches to another song.
Script in Sound:
local Sound = Instance.new("Sound", game.Workspace)
Sound.Name = "SongAcreol2"
local musicList = require(game.ServerScriptService.SongList)
local Event = game.ReplicatedStorage.ApoxyzMusicChange
local musicName = musicList
local Activate = false
local keys = {}
for key, _ in pairs(musicList) do
table.insert(keys, key)
end
game.Players.PlayerAdded:Connect(function(player)
if Activate == false then
Activate = true
while true do
local Change = game.ReplicatedStorage.ChangeSong
Change.OnServerEvent:Connect(function(player, text)
Sound:Stop()
wait(0.5)
Sound.SoundId = "rbxassetid://"..text
local musicNameInfo = game:GetService("MarketplaceService"):GetProductInfo(text).Name
Event:FireAllClients(musicNameInfo)
Sound:Play()
Sound.Ended:Wait()
end)
local Skip = game.ReplicatedStorage.SkipSong
Skip.OnServerEvent:Connect(function()
Sound:Stop()
wait(0.5)
local randomKey = keys[math.random(#keys)]
Sound.SoundId = "rbxassetid://"..randomKey
musicName = musicList[randomKey]
Event:FireAllClients(musicName)
Sound:Play()
Sound.Ended:Wait()
end)
wait(0.5)
local randomKey = keys[math.random(#keys)]
Sound.SoundId = "rbxassetid://"..randomKey
Sound:Play()
musicName = musicList[randomKey]
Event:FireAllClients(musicName)
Sound.Ended:Wait()
end
end
Event:FireClient(player, musicName)
end)
Local Script in TextLabel:
local Event = game.ReplicatedStorage.ApoxyzMusicChange
Event.OnClientEvent:Connect(function(musicName)
if musicName then
script.Parent.Text = musicName
end
end)

9 comments
Seems to be working great, thank you, this has been aggravating me for awhile. I deleted the other post because I didn't realize you'd come back to check the comment I posted. This code is supposed to run constantly, not just once but it still works and the song changes and shows the name for everyone even when they join. Thank you again!
Any time, glad to help!
Yeah it broke again, it works great when you first join but when the song switches it just breaks. I'm getting sick of this, do you have any suggestions? I edited the post and made it the full script.
I think I've fixed your changes.
For some reason it still isn't working, it's being really weird but I don't want to bother you again with this. I've just been really busy with work so I can't work on this that much as I want too. It's been making me mad lol. I'll probably work on it later on with some of yours tips to help me. Thanks for everything.
It sometimes stops playing for the 2nd half of the song, after a switch it will sometimes start a song already half way through, sometimes just switches and shows the song name but doesn't play the song. Not sure if you know what could be causing any of this?
Your first problem may be from Roblox only allowing 1 minute 20 second audio files. So if you have a song that's 3 minutes long, you'll need at least 2 audio files (you'll still lose the last 20 seconds of the song though unless you play a third audio file).
As far as the second problem, I'm honestly not sure. I tested the code given in every way I could think of and it worked just fine. This tells me there's something else in your code that I don't have, unless of course it's because of the 1 minute 20 second problem.
I'm not too sure either man, thanks for your help though.