SoundStopped

Constructor:

SoundStopped()

Description

This event is triggered when the playing audio object is stopped.

Examples

Create an Audiosource player. Assign the audio path to the player to play, and stop playing after 2 seconds. Observe whether the event is triggered when the audio is stopped playing or not.

function SoundEvent() -- define the method when the audio object is stopped
    print("The event that the audio is stopped playing is triggered")
end
local AS = RWObject.Create("AudioSource") -- create a player
AS.PlayOnAwake =false
AS.AudioClip = "rwid://L1vtZTBThT1RCvBVdK" -- assign a path
AS.SoundStopped:Connect(SoundEvent) -- register the event that the audio object is stopped
AS:Play() -- play the audio
wait(2) -- wait 2
AS:Stop() -- stop the audio