Help with your scripting

Audio - isPlaying and isPaused not working?

Audio - isPlaying and isPaused not working?

Postby Shando » 12 May 2022, 22:58

Hi all,

I'm trying to pause the background music when I open a specific GUI and then resume it when the GUI is closed. However, it doesn't seem to resume?

I'm using this code to test:
Code: Select all
if mySound1:isPlaying ( ) then
lprint("PLAYING")
else
lprint("IS NOT PLAYING")
end
if mySound1:isPaused ( ) then
lprint("PAUSED")
else
lprint("IS NOT PAUSED")
end

mySound1:pause ( )

if mySound1:isPlaying ( ) then
lprint("PLAYING")
else
lprint("IS NOT PLAYING")
end
if mySound1:isPaused ( ) then
lprint("PAUSED")
else
lprint("IS NOT PAUSED")
end


What I get in the console is:
Code: Select all
IS NOT PLAYING
IS NOT PAUSED
IS NOT PLAYING
IS NOT PAUSED


mySound1 is definitely playing before it hits the 'pause ( )' and it definitely pauses afterwards, so I should be getting:

Code: Select all
IS PLAYING
IS NOT PAUSED
IS NOT PLAYING
IS PAUSED


Thanks

Shando
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 557
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 2 guests