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

Calling a function on a boolvalue change?

Asked by
iFlusters 355 Moderation Voter
8 years ago

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

Log in to vote
1
Answered by 8 years ago

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)
Ad

Answer this question