PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Volume

SoundGroup

float

The volume multiplier applied to Sounds that are in the SoundGroup. This value ranges from 0 to 10.

This property acts as a multiplier, and thus sounds in a SoundGroup will retain their relative volumes when it is set. This means if a sound’s Sound/Volume is 0.5 and it is assigned to a SoundGroup with a volume of 0.5, its effective volume will be 0.25.


Code Samples


SoundGroups

This sample demonstrates how a SoundGroup can be used to change the volume of its associated Sounds and apply SoundEffects.

In this example a Sound is instanced in the Workspace and assigned to a new SoundGroup. The Sound is played and during playback the volume is changed via the SoundGroup and a SoundEffect is added.

local SoundService = game:GetService("SoundService")

-- create a sound group
local soundGroup = Instance.new("SoundGroup", SoundService)

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://301964312"
sound.Looped = true
sound.PlaybackSpeed = 2
sound.SoundGroup = soundGroup

-- play the sound
sound:Play()

wait(10)

-- change the volume
soundGroup.Volume = 0.1 

wait(3)

-- return the volume
soundGroup.Volume = 0.5
 
wait(4)

-- add a sound effect
Instance.new("ReverbSoundEffect", soundGroup)