Skip to main content

Groups

RequiresSchema

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​

Groups.Get(
name: string--

The group name.

) → SoundGroup?--

The SoundGroup, or nil.

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())
Show raw api
{
    "functions": [
        {
            "name": "Get",
            "desc": "```lua\nlocal music = VluxySF.Groups.Get(\"MUSIC\")\n\nif music then\n\tprint(music.Volume)\nend\n```",
            "params": [
                {
                    "name": "name",
                    "desc": "The group name.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "The `SoundGroup`, or `nil`.",
                    "lua_type": "SoundGroup?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 71,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "GetAll",
            "desc": "```lua\nfor name, group in VluxySF.Groups.GetAll() do\n\tprint(name, group.Volume)\nend\n```",
            "params": [],
            "returns": [
                {
                    "desc": "Every `SoundGroup`, keyed by name. Empty before the library has started.",
                    "lua_type": "SoundGroups"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "GetMain",
            "desc": "```lua\nprint(VluxySF.Groups.GetMain())\n```",
            "params": [],
            "returns": [
                {
                    "desc": "The main `SoundGroup` every group sits under, or `nil` before the library has started.",
                    "lua_type": "SoundGroup?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 107,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "GetNames",
            "desc": "```lua\nprint(VluxySF.Groups.GetNames())\n```",
            "params": [],
            "returns": [
                {
                    "desc": "A new array of every group name, in the order the groups appear under `SOUNDS`.",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 124,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "SetVolume",
            "desc": "Sets the volume of one group. A group name that does not exist prints a warning.\n\n```lua\nVluxySF.Groups.SetVolume(\"MUSIC\", 0.4)\n```",
            "params": [
                {
                    "name": "name",
                    "desc": "The group name.",
                    "lua_type": "string"
                },
                {
                    "name": "volume",
                    "desc": "The volume, from 0 to 10.",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 146,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "SetVolumes",
            "desc": "Sets several group volumes at once. A group name that does not exist prints a warning and is skipped.\n\n```lua\nVluxySF.Groups.SetVolumes({\n\tMUSIC = 0.7,\n\tSFX = 0.5,\n})\n```",
            "params": [
                {
                    "name": "volumes",
                    "desc": "Group volumes, keyed by group name.",
                    "lua_type": "{ [string]: number }"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 178,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "SetMainVolume",
            "desc": "Sets the volume of the main `SoundGroup` that every other group sits under.\n\n```lua\nVluxySF.Groups.SetMainVolume(0.3)\n```",
            "params": [
                {
                    "name": "volume",
                    "desc": "The volume, from 0 to 10.",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 205,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "GetVolumes",
            "desc": "Returns every group volume, keyed by group name. Pairs with `SetVolumes` for saving and loading settings.\n\n```lua\nlocal saved = VluxySF.Groups.GetVolumes()\n-- later:\nVluxySF.Groups.SetVolumes(saved)\n```",
            "params": [],
            "returns": [
                {
                    "desc": "Group volumes, keyed by group name. Empty before the library has started.",
                    "lua_type": "{ [string]: number }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 229,
                "path": "lib/Api/Groups.luau"
            }
        },
        {
            "name": "GetMainVolume",
            "desc": "```lua\nprint(VluxySF.Groups.GetMainVolume())\n```",
            "params": [],
            "returns": [
                {
                    "desc": "The main volume. `1` before the library has started.",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 252,
                "path": "lib/Api/Groups.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Groups",
    "desc": "Reads and adjusts the `SoundGroups` the library made from your `SOUNDS` Configuration.\n\nEvery group sits under one main `SoundGroup` named `SOUNDS` in `SoundService`, so the main volume scales all of\nthem.\n\n:::info\nThe groups are made on the server and replicate. Setting a volume on a client changes it for that player only,\nwhich is what a settings menu wants. Setting it on the server changes it for every player.\n:::\n\nCalled before the library has started, every function here warns once and returns an empty result or does nothing.\nA volume that is not a number from 0 to 10 prints a warning and is ignored.",
    "tags": [
        "RequiresSchema"
    ],
    "source": {
        "line": 29,
        "path": "lib/Api/Groups.luau"
    }
}