function PlayInGameMusic() for i,v in pairs(game.Players:GetPlayers()) do pcall(function() if v.PlayerGui:FindFirstChild("LobbyMusic") then v.PlayerGui.LobbyMusic.Volume = 0 local sound = Instance.new("Sound") sound.Name = "InGameMusic" sound.SoundId = "http://www.roblox.com/asset/?id=151011272" sound.Parent = v.PlayerGui sound.Volume = 0.8 sound.Pitch = 1 sound.Looped = true sound:Play() else end end) end end
It works in play solo mode,But in multiplayer the "Lobby Music" keeps playing,Anyone help?
I don't know why it wouldn't be turning off.. perhaps you could try to just turn off ALL music in the player's playergui - just to be sure?
And I don't know why you used pcall, or put a blank else statement in your code..
function PlayInGameMusic() for i,v in pairs(game.Players:GetPlayers()) do for a,b in pairs(v.PlayerGui:GetChildren()) do if b:IsA('Sound') then b:Destroy() end end end local sound = Instance.new("Sound",v.PlayerGui) sound.Name = "InGameMusic" sound.SoundId = "http://www.roblox.com/asset/?id=151011272" sound.Volume = 0.8 sound.Pitch = 1 sound.Looped = true sound:Play() end