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

01local sound1 = 918984470
02local sound2 = 949583914
03local sound3 = 390846973
04music=script.Parent
05 
06 
07while true do
08    wait()
09    music.SoundId="rbxassetid://"..sound1
10    music:Play()
11    music.Ended:wait()
12    wait()
13    music.SoundId="rbxassetid://"..sound2
14    music:Play()
15    music.Ended:wait()
View all 21 lines...

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 — 7y
1
Have you tried making this a LocalScript to see what happens? >-> TheeDeathCaster 2368 — 7y
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 — 7y
0
Thanks TheeDeathCaster. That worked. I have already tried it before, but it didn't seem to work back then... sebse456 13 — 7y
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 — 7y
0
It actually work on my studio. Lol. Swiftives 15 — 7y

1 answer

Log in to vote
0
Answered by 7 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

01local sound1 = 918984470
02local sound2 = 949583914
03local sound3 = 390846973
04local music = script.Parent
05 
06local function PlaySong(soundId)
07    music.SoundId="rbxassetid://"..soundId
08    music:Play()
09    print("Playing song: " .. soundId)
10 
11    -- If statement just so I don't have to listen to the whole song
12    if soundId == 390846973 then
13        music.TimePosition = 30
14    else
15        music.TimePosition = 250
View all 25 lines...
Ad

Answer this question