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

Why does this music play even though it's paused?

Asked by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

0
How long does the sound last? Teeter11 281 — 10y
0
Not sure. Fairly long, but I don't see how the length would affect this. Perci1 4988 — 10y
0
This is working fine for me when I tested. BlueTaslem 18071 — 10y
0
Make sure you actually play the game, because when I tested it in PlaySolo it worked differently than online. Perci1 4988 — 10y

Answer this question