I am working on a random music player that plays when the game loads but for some reason the song id just gets set to blank after the script is run, I confirmed this by setting the soundid manually to one of them and once the script is loaded the music stops running
if script.Parent.Parent == game.ReplicatedFirst then -- Checks if it's in replicated first and if so will move to PlayerGui
local clone = script.Parent:Clone()
clone.Parent = game.Players.LocalPlayer.PlayerGui
script.Parent:Destroy()
end
local music = {5409360995,1845554017,9048045656,9044564552} -- Setting up variables and arrays
local sound = script.Sound
local mute = script.Parent.Frame.Mute
local playpause = script.Parent.Frame.PlayPause
local skip = script.Parent.Frame.Skip
local gen = 0
local mutedvar = script.IsMuted
local playingvar = script.IsPlaying
local song = 1
mutedvar.Value = 0 -- Setting Values
sound.Playing = true
table.sort(music, function() -- Shuffles Music
return Random.new():NextNumber() < 0.5
end)
function sortmusic() -- Shuffle Music Function
table.sort(music, function()
return Random.new():NextNumber() < 0.5
end)
end
while true do -- Button Checking Script
wait()
if mute.MouseButton1Click then
if mutedvar.value == 0 then
sound.Volume = 0
mutedvar.Value = 1
end
else
sound.Volume = 0.5
mutedvar.Value = 0
end
if playpause.MouseButton1Click then
end
if skip.MouseButton1Click then
end
end
while true do -- Music Player Script
sound.Playing = true
sound.IsPlaying = true
sound.SoundId = ("rbxassetid://" + music[song])
song +=1
repeat wait() until sound.IsPlaying == false
if #music == song then
sortmusic()
end
end

1 comment
uhhhhhhhhhh too long?