I've been trying different ways to get rid of that huge lag spike that occurs when songs change. The best so far is to quickly play then pause the songs. However, even when I do song:Pause()
multiple times, it still plays! I can't seem to fix the problem.
Both this LocalScript and the music is located inside some GUIs I have set up.
local village = script.Parent:WaitForChild("Message"):FindFirstChild("VillageMusic",true) --This path is correct. print("Found it") local vol = village.Volume village.Volume = 0 print("Volume is 0") village:Play() print("Played it") wait(0.5) village:Pause() print("Paused it") village.Volume = vol print("Volume is normal") print(village.IsPlaying) wait() if village.IsPlaying then print("Making it stop...") village:Pause() end print(village.IsPlaying)
When this code runs, I get the following output:
Found it Volume is 0 Played it Paused it Volume is normal false false
Since IsPlaying is obviously false, you'd think that the music wouldn't be playing, right?
But it DOES play.
I can hear it as clear as day. I don't really understand this error, please help.