This item is not replicated across Roblox’s server/client boundary.
This property can only be read from. Attempting to write to it will cause an error.
The length of the
Sound in seconds. If the
Sound is not loaded, this value will be 0.
This property is often used in conjunction with
Sound/PlaybackSpeed to adjust the speed of a sound so it lasts for a specific duration (see examples). When
Sound/PlaybackSpeed is equal to 1, the sound will take TimeLength seconds to complete.
Play a Sound for a Specific Duration
This code sample includes a simple function that uses Sound.TimeLength and Sound.PlaybackSpeed to play a sound that’ll take the given duration to complete. It achieves this by setting the PlaybackSpeed of the sound to be equal to the TimeLength of the sound divided by the desired duration.
Note that as TimeLength is equal to 0 when the sound has not loaded, the function will yield whilst it loads the sound.