Skip to main content

Cache

This item only works when running on the client. ClientRequiresSchema

Warming a sound builds it once and keeps the ready-made Sound, effects included, in SoundService.WarmedSounds. While it is warmed, Fetch clones it instead of building it. Chilling it destroys the kept copy. Use this for sounds that matter during one part of the game, and chill them when that part is over.

Keeping the Sound also makes Roblox start downloading its audio, but warming does not wait for that; to have audio loaded before it is needed, see Preload. The kept copy is silent: it never plays, and PlayOnRemove is off on it and restored on the clones Fetch hands out.

Called on the server or before the library has started, every function here warns once and does nothing.

Functions​

Warm​

Cache.Warm(
...: string--

The sound names.

) → ()

Warms sounds by name. A name that is already warmed is skipped. A name that is not in the schema prints a warning.

VluxySF.Cache.Warm("BossRoar", "BossStomp")

Chill​

Cache.Chill(
...: string--

The sound names.

) → ()

Chills sounds by name: their kept copies are destroyed. Sounds you already fetched are not affected. A name that is not warmed is ignored.

VluxySF.Cache.Chill("BossRoar", "BossStomp")

IsWarmed​

Cache.IsWarmed(
name: string--

The sound name.

) → boolean--

Whether the sound is warmed.

print(VluxySF.Cache.IsWarmed("BossRoar"))

GetNames​

Cache.GetNames() → {string}--

A new array of every warmed sound name, sorted.

print(VluxySF.Cache.GetNames())
Show raw api
{
    "functions": [
        {
            "name": "Warm",
            "desc": "Warms sounds by name. A name that is already warmed is skipped. A name that is not in the schema prints a warning.\n\n```lua\nVluxySF.Cache.Warm(\"BossRoar\", \"BossStomp\")\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "The sound names.",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 39,
                "path": "lib/Api/Cache.luau"
            }
        },
        {
            "name": "Chill",
            "desc": "Chills sounds by name: their kept copies are destroyed. Sounds you already fetched are not affected. A name that is\nnot warmed is ignored.\n\n```lua\nVluxySF.Cache.Chill(\"BossRoar\", \"BossStomp\")\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "The sound names.",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 74,
                "path": "lib/Api/Cache.luau"
            }
        },
        {
            "name": "IsWarmed",
            "desc": "```lua\nprint(VluxySF.Cache.IsWarmed(\"BossRoar\"))\n```",
            "params": [
                {
                    "name": "name",
                    "desc": "The sound name.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Whether the sound is warmed.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 95,
                "path": "lib/Api/Cache.luau"
            }
        },
        {
            "name": "GetNames",
            "desc": "```lua\nprint(VluxySF.Cache.GetNames())\n```",
            "params": [],
            "returns": [
                {
                    "desc": "A new array of every warmed sound name, sorted.",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 112,
                "path": "lib/Api/Cache.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Cache",
    "desc": "Warming a sound builds it once and keeps the ready-made `Sound`, effects included, in `SoundService.WarmedSounds`.\nWhile it is warmed, `Fetch` clones it instead of building it. Chilling it destroys the kept copy. Use this for\nsounds that matter during one part of the game, and chill them when that part is over.\n\nKeeping the `Sound` also makes Roblox start downloading its audio, but warming does not wait for that; to have\naudio loaded before it is needed, see `Preload`. The kept copy is silent: it never plays, and `PlayOnRemove` is off\non it and restored on the clones `Fetch` hands out.\n\nCalled on the server or before the library has started, every function here warns once and does nothing.",
    "tags": [
        "RequiresSchema"
    ],
    "realm": [
        "Client"
    ],
    "source": {
        "line": 26,
        "path": "lib/Api/Cache.luau"
    }
}