Groups
Reads and adjusts the SoundGroups the library made from your SOUNDS Configuration.
Every group sits under one main SoundGroup named SOUNDS in SoundService, so the main volume scales all of
them.
INFO
The groups are made on the server and replicate. Setting a volume on a client changes it for that player only, which is what a settings menu wants. Setting it on the server changes it for every player.
Called before the library has started, every function here warns once and returns an empty result or does nothing. A volume that is not a number from 0 to 10 prints a warning and is ignored.
Functions
Get
local music = VluxySF.Groups.Get("MUSIC")
if music then
print(music.Volume)
end
GetAll
Groups.GetAll() → SoundGroups--
Every SoundGroup, keyed by name. Empty before the library has started.
for name, group in VluxySF.Groups.GetAll() do
print(name, group.Volume)
end
GetMain
Groups.GetMain() → SoundGroup?--
The main SoundGroup every group sits under, or nil before the library has started.
print(VluxySF.Groups.GetMain())
GetNames
Groups.GetNames() → {string}--
A new array of every group name, in the order the groups appear under SOUNDS.
print(VluxySF.Groups.GetNames())
SetVolume
Groups.SetVolume(name: string,--
The group name.
volume: number--
The volume, from 0 to 10.
) → ()Sets the volume of one group. A group name that does not exist prints a warning.
VluxySF.Groups.SetVolume("MUSIC", 0.4)
SetVolumes
Groups.SetVolumes(volumes: {[string]: number}--
Group volumes, keyed by group name.
) → ()Sets several group volumes at once. A group name that does not exist prints a warning and is skipped.
VluxySF.Groups.SetVolumes({
MUSIC = 0.7,
SFX = 0.5,
})
SetMainVolume
Groups.SetMainVolume(volume: number--
The volume, from 0 to 10.
) → ()Sets the volume of the main SoundGroup that every other group sits under.
VluxySF.Groups.SetMainVolume(0.3)
GetVolumes
Groups.GetVolumes() → {[string]: number}--
Group volumes, keyed by group name. Empty before the library has started.
Returns every group volume, keyed by group name. Pairs with SetVolumes for saving and loading settings.
local saved = VluxySF.Groups.GetVolumes()
-- later:
VluxySF.Groups.SetVolumes(saved)
GetMainVolume
Groups.GetMainVolume() → number--
The main volume. 1 before the library has started.
print(VluxySF.Groups.GetMainVolume())