Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What did I do wrong with this music script? I found it on the internet, and it has always worked.

So I have this script, and I use it for background music in game. The script is a normal script (a-non-local and stuff like that) and the sound that plays the music is called "Music". The sound is in the StarterGui.

local sound1 = 918984470
local sound2 = 949583914
local sound3 = 390846973
music=script.Parent


while true do
    wait()
    music.SoundId="rbxassetid://"..sound1
    music:Play()
    music.Ended:wait()
    wait()
    music.SoundId="rbxassetid://"..sound2
    music:Play()
    music.Ended:wait()
    wait()
    music.SoundId="rbxassetid://"..sound3
    music:Play()
    music.Ended:wait()
    wait()
end


When I look in the output it says "Sound"" failed to load in "StarterGui.Music.SoundId": Request failed"

6 comments

0

Try adding a wait(2) in the beginning of the script because roblox gets wonky loading in. I'll take a further look in if this doesn't work.

1

Have you tried making this a LocalScript to see what happens? >->

0

did you copy the soundids from the roblox site? if so try subtracting 1 from them or put then into a sound in studio and then use the number it give you.

0

Thanks TheeDeathCaster. That worked. I have already tried it before, but it didn't seem to work back then...

0

https://scriptinghelpers.org/help/community-guidelines Attempts should be your own work. Don't take a free model and expect us to fix it.^

0

It actually work on my studio. Lol.

1 answer

It works for me with your script or mine. And also works with a local script or server script. Here's a picture of StarterGui- imgur

local sound1 = 918984470
local sound2 = 949583914
local sound3 = 390846973
local music = script.Parent

local function PlaySong(soundId)
    music.SoundId="rbxassetid://"..soundId
    music:Play()
    print("Playing song: " .. soundId)
	
	-- If statement just so I don't have to listen to the whole song
	if soundId == 390846973 then
		music.TimePosition = 30
	else
		music.TimePosition = 250
	end	

    music.Ended:wait()
end

while wait() do
	PlaySong(sound1)
	PlaySong(sound2)
	PlaySong(sound3)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.