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
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
Nevermind, just found out how to fix it, the problem was that i was not updating the music