Sound Not Working - Client / Server?

Hello. I recently made a music system in Roblox, and it’s really messing with my head.

If I play the game, I do not hear any music.
If I run the game (server only), I hear music.
If I test the game (client), I don’t hear music.
If I test the game on a client, then switch to server, I don’t hear music.

???
Any help???

(There are no error logs in the output)

Note: The audio is in SoundService

Is there any script for you to show us?

1 Like
wait(1.5)

local Sound = game:GetService("SoundService"):WaitForChild("CurrentSong")

local buffer = 5

local seed = 3.85
function Seed()
	seed=seed+3.85
	math.randomseed(tick()+seed)
end

local recentlyPlayed = {}
local songList = {}

for i,v in pairs(script:GetChildren()) do
	table.insert(songList,#songList+1,v.Name)
end

function pickSong()
	local availableList = {}
	for i,v in pairs(songList) do
		if not table.find(recentlyPlayed,v) then
			table.insert(availableList,#availableList+1,v)
		end
	end
	Seed(); local index = math.random(1,#availableList)
	local songName = availableList[index]
	if #recentlyPlayed>=buffer then table.remove(recentlyPlayed,1) end
	table.insert(recentlyPlayed,#recentlyPlayed+1,songName)
	return songName
end

while true do
	local songName = pickSong()
	local songItem = script:FindFirstChild(songName) or script:FindFirstChild("Queen - Bohemian Rhapsody")
	Sound.TimePosition = 0
	Sound.SoundId = songItem.Value
	Sound.Volume = songItem.Volume.Value
	Sound.PlaybackSpeed = songItem.PlaybackSpeed.Value
	Sound.SongName.Value = songName
	wait(.5)
	Sound:Play()
	Sound.Ended:Wait()
	wait()
end

I moved it to workspace and it works now!

1 Like

Yeah I was going to say I think there is an issue with where this is placed. But I am glad that it works now! :slight_smile:

1 Like