Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Calling a function on a boolvalue change?

I used this:

Music.IsPlaying.Changed:connect(PlayMusic)

and it gave me an error, basically when the 'IsPlaying' property of Music changes it will call a function, any help greatly appreciated.

1 answer

✓ Accepted answer

IsPlaying is a boolean value, they can't be indexed (don't have values within them). Changed is an event of your Sound object Music. Unfortunately the Changed event doesn't fire on a Sound object for the IsPlaying property. However there are other events that are fired when a Sound object's IsPlaying property may change. Sound.Played

Music.Played:connect(MusicPlayed)

Sound.Paused

Music.Paused:connect(MusicPaused)

Sound.Stopped

Music.Stopped:connect(MusicStopped)

Sound.Ended

Music.Ended:connect(MusicEnded)

This discussion is preserved as it was. New answers, comments, and votes are closed.