Skip to main content

Settings

Every tunable is an attribute on the Ocean ModuleScript. The server writes them, so they replicate to every client; the Studio plugin's panel is generated from Settings.List. Change them from a server script with Settings.Set or simply Ocean:SetAttribute(name, value).

Settings marked Weather = true are the ones a weather can override (see Ocean:CreateWeather).

Types​

Entry​

interface Entry {
Name: string--

the attribute name

Default: number | boolean | Color3 | string
Section: string--

the panel section it belongs to

Min: number?--

numbers only

Max: number?--

numbers only

Step: number?--

slider step

Weather: boolean?--

a weather may override it

Rebuild: boolean?--

changing it rebuilds the surface mesh

Options: {string}?--

strings with a fixed set of choices

Snaps: {number}?--

numbers whose slider lands on these values only

Hint: string?--

what the setting does, as shown in the plugin

}

Properties​

List​

Settings.List: {Entry}

Every setting, in panel order.

Spec​

Settings.Spec: {[string]: Entry}

The same entries keyed by name.

Defaults​

Settings.Defaults: {[string]: any}

Default value per setting name.

Functions​

GetHost​

Settings.GetHost() → Instance

The Instance whose attributes hold the settings (the Ocean ModuleScript).

LocalOverride​

This item only works when running on the client. Client
Settings.LocalOverride(name: string) → any

A client-local override set with Settings.SetLocalOverride, or nil.

SetLocalOverride​

This item only works when running on the client. Client
Settings.SetLocalOverride(
name: string,
value: any
) → ()

Makes this client use value instead of the replicated setting, for everything that reads Settings.Get. Never replicated and never written to the module. The Zones addon uses it to give a player inside a zone that zone's look everywhere they look. Pass nil to clear.

Get​

Settings.Get(name: string) → any

The effective value of a setting on this side: the local override if any, else the attribute, else the default.

Set​

This item only works when running on the server. Server
Settings.Set(
name: string,
value: any
) → any

Validates and clamps the value against the spec and writes the attribute. Returns the value stored, or nil if it was rejected (unknown name, wrong type, or a string outside the entry's Options).

OnChanged​

Settings.OnChanged(fn: (name: string) → ()) → Connection--

call :Disconnect() to stop

Calls fn(name) whenever a setting changes on this side, whether by attribute or local override.

PublishDefaults​

This item only works when running on the server. Server
Settings.PublishDefaults() → ()

Writes every default that is not yet an attribute, so all settings show in Properties and replicate. Ocean.Init does this.

Reset​

This item only works when running on the server. Server
Settings.Reset() → ()

Sets every setting back to its default.

Show raw api
{
    "functions": [
        {
            "name": "SetHost",
            "desc": "",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 365,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "GetHost",
            "desc": "The Instance whose attributes hold the settings (the Ocean ModuleScript).",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 374,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "LocalOverride",
            "desc": "A client-local override set with [Settings.SetLocalOverride], or nil.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 391,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "SetLocalOverride",
            "desc": "Makes this client use `value` instead of the replicated setting, for everything that reads\n[Settings.Get]. Never replicated and never written to the module. The Zones addon uses it to give a\nplayer inside a zone that zone's look everywhere they look. Pass nil to clear.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 404,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "Get",
            "desc": "The effective value of a setting on this side: the local override if any, else the attribute,\nelse the default.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 419,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "Set",
            "desc": "Validates and clamps the value against the spec and writes the attribute. Returns the value stored,\nor nil if it was rejected (unknown name, wrong type, or a string outside the entry's Options).",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 440,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "OnChanged",
            "desc": "Calls `fn(name)` whenever a setting changes on this side, whether by attribute or local override.",
            "params": [
                {
                    "name": "fn",
                    "desc": "",
                    "lua_type": "(name: string) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "call `:Disconnect()` to stop",
                    "lua_type": "Connection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 463,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "PublishDefaults",
            "desc": "Writes every default that is not yet an attribute, so all settings show in Properties and replicate.\n[Ocean.Init] does this.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 481,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "Reset",
            "desc": "Sets every setting back to its default.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 494,
                "path": "src/Ocean/Settings.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "List",
            "desc": "Every setting, in panel order.",
            "lua_type": "{ Entry }",
            "source": {
                "line": 37,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "Spec",
            "desc": "The same entries keyed by name.",
            "lua_type": "{ [string]: Entry }",
            "source": {
                "line": 42,
                "path": "src/Ocean/Settings.luau"
            }
        },
        {
            "name": "Defaults",
            "desc": "Default value per setting name.",
            "lua_type": "{ [string]: any }",
            "source": {
                "line": 47,
                "path": "src/Ocean/Settings.luau"
            }
        }
    ],
    "types": [
        {
            "name": "Entry",
            "desc": "",
            "fields": [
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": "the attribute name"
                },
                {
                    "name": "Default",
                    "lua_type": "number | boolean | Color3 | string",
                    "desc": ""
                },
                {
                    "name": "Section",
                    "lua_type": "string",
                    "desc": "the panel section it belongs to"
                },
                {
                    "name": "Min",
                    "lua_type": "number?",
                    "desc": "numbers only"
                },
                {
                    "name": "Max",
                    "lua_type": "number?",
                    "desc": "numbers only"
                },
                {
                    "name": "Step",
                    "lua_type": "number?",
                    "desc": "slider step"
                },
                {
                    "name": "Weather",
                    "lua_type": "boolean?",
                    "desc": "a weather may override it"
                },
                {
                    "name": "Rebuild",
                    "lua_type": "boolean?",
                    "desc": "changing it rebuilds the surface mesh"
                },
                {
                    "name": "Options",
                    "lua_type": "{ string }?",
                    "desc": "strings with a fixed set of choices"
                },
                {
                    "name": "Snaps",
                    "lua_type": "{ number }?",
                    "desc": "numbers whose slider lands on these values only"
                },
                {
                    "name": "Hint",
                    "lua_type": "string?",
                    "desc": "what the setting does, as shown in the plugin"
                }
            ],
            "source": {
                "line": 32,
                "path": "src/Ocean/Settings.luau"
            }
        }
    ],
    "name": "Settings",
    "desc": "Every tunable is an attribute on the Ocean ModuleScript. The server writes them, so they replicate\nto every client; the Studio plugin's panel is generated from [Settings.List]. Change them from a\nserver script with [Settings.Set] or simply `Ocean:SetAttribute(name, value)`.\n\nSettings marked `Weather = true` are the ones a weather can override (see [Ocean:CreateWeather]).",
    "source": {
        "line": 17,
        "path": "src/Ocean/Settings.luau"
    }
}