PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

Looped

Sound

bool

This sets whether or not the Sound repeats once it has finished when it is playing.

Looped sounds are suitable for a range of applications including music and background ambient sounds. The Sound/DidLoop event can be used to track the number of times as sound has looped.


Code Samples


Sound Looping

Whilst looping is most appropriate for longer tracks such as music or ambient sounds, this sample demonstrates sound looping by creating the Roblox death sound in every character’s head and looping it.

The Players.PlayerAdded and Player.CharacterAdded functions are used to detect new player characters. One a new character has been added a sound is created in their head. For demonstration purposes, the Sound.DidLoop function is used to show how the number of times a particular sound has looped can be tracked.


Loop a Number of Times

This code sample includes a function that will play a sound and allow it to loop for a given number of times before stopping it.