Hello there!
I have a script where it works on one game but in the other it doesnt. I made sure to give permissions but it’s still not working.
Script:
local songIds = {"9616160367","9616159629","9616158066","9616165516","9616164972","9662147992","9616208762","9616161750","9616232668","9616164122","9616162852"}
local loadedSong = {}
for _,songId in pairs(songIds) do
local song = Instance.new("Sound")
song.SoundId = "rbxassetid://"..songId
song.Parent = script
song.Volume = 0.2
song.PlayOnRemove = true
song.Name = songId
loadedSong[songId] = song
end
local songs = {
[14253378] = {
[14] = "9662147992",
[13] = "9616159629",
[9] = "9616158066",
[5] = "9616165516",
[4] = "9616164972",
},
[14243751] = {
[16] = "9659803860",
},
[14252305] = {
[11] = "9616208762",
[10] = "9616161750",
[9] = "9616232668"
},
[14252276] = {
[11] = "9616164122",
},
[14401043] = {
[7] = "9616162852",
[6] = "9616162852",
[5] = "9616162852",
[4] = "9616162852",
[3] = "9616162852",
[2] = "9616162852",
[1] = "9616162852",
},
}
function playSong(id)
wait(1)
if loadedSong[id] then
if loadedSong[id].IsLoaded then
local song = loadedSong[id]:Clone()
song.Parent = game:GetService("SoundService")
song:Destroy()
else
playSong(id)
wait(1)
end
else
playSong(id)
wait(1)
end
end
game:GetService("Players").PlayerAdded:Connect(function(player)
if (songs[14253378][player:GetRankInGroup(14253378)]) then
playSong(songs[14253378][player:GetRankInGroup(14253378)])
elseif (songs[14243751][player:GetRankInGroup(14243751)]) then
playSong(songs[14243751][player:GetRankInGroup(14243751)])
elseif (songs[14252305][player:GetRankInGroup(14252305)]) then
playSong(songs[14252305][player:GetRankInGroup(14252305)])
elseif (songs[14252276][player:GetRankInGroup(14252276)]) then
playSong(songs[14252276][player:GetRankInGroup(14252276)])
elseif (songs[14401043][player:GetRankInGroup(14401043)]) then
playSong(songs[14401043][player:GetRankInGroup(14401043)])
end
end)