New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Music Manager won't change music?

Asked by 8 months ago

The music won't change when the variable updates, can you help me?

loop = true
local Sound = script.Sound
id = 0
playingid = 0
wait(1)
local stage = script.parent.parent.CheckPointNumber.Value
while loop == true do
    if stage > 0 and stage < 2 then --Song1 
    id = script.Song1.Value
end
    if stage > 1 and stage < 3 then --Song2
    id = script.Song2.Value
end
    if stage > 2 and stage < 4 then --Song3
    id = script.Song3.Value
end
    if stage > 3 and stage < 5 then --Song4
    id = script.Song4.Value
end
    if stage > 4 and stage < 6 then --Song5
    id = script.Song5.Value
    end
    --Play--
    if id ~= playingid then
    Sound:Stop()
    Sound.SoundId = "http://www.roblox.com/asset/?id="..id
    Sound:Play()
    playingid = id
    end
    wait(1)
end

2 answers

Log in to vote
0
Answered by 8 months ago

Just have a sound and put a script in it, make the soundid something :Play() go down a line and use script.Parent.Ended:wait()

local sound = script.Parent while true do sound.soundid = "" sound:Play() sound.Ended:wait() sound.soundid = "" sound:Play() sound.Ended:wait() end

Ad
Log in to vote
0
Answered by 8 months ago

Nevermind, just found out how to fix it, the problem was that i was not updating the music

Answer this question