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.
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