Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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"

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. oftenz 367 — 6y
1
Have you tried making this a LocalScript to see what happens? >-> TheeDeathCaster 2368 — 6y
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. justoboy13 153 — 6y
0
Thanks TheeDeathCaster. That worked. I have already tried it before, but it didn't seem to work back then... sebse456 13 — 6y
View all comments (2 more)
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.^ brokenVectors 525 — 6y
0
It actually work on my studio. Lol. Swiftives 15 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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
Ad

Answer this question