Skip to main content

RestraintPluginModule

Module for the RestraintPlugin

Types

ConstraintRestraintConfig

interface ConstraintRestraintConfig {
openAnglenumber
closedAnglenumber--

Angle while restraint is closed and seat is empty

clampedAnglenumber--

Angle while restraint is closed and a character is seated in the seat

}

All values are in degrees, as they are used to set the .Angle value of the HingeConstraint.

Properties

RestraintPlugin

RestraintPluginModule.RestraintPlugin: RestraintPlugin

Restraint

RestraintPluginModule.Restraint: Restraint

Restraint_Client

RestraintPluginModule.Restraint_Client: Restraint_Client

Restraint_Server

RestraintPluginModule.Restraint_Server: Restraint_Server

Functions

restraintsWithTag

RestraintPluginModule.restraintsWithTag(tagstring?="RESTRAINT") → (modelModel) → {Instance}

Creates a function which gets descendants from a Model with the given tag.

clickRestraint

RestraintPluginModule.clickRestraint(
restraintRestraint,
clickDistancenumber?,
validatePlayer((playerPlayer) → boolean)?
) → ()

Sets a Restraint so that it can be open/closed by clicking on it via a ClickDetector

Restraint model must have a child named ClickDetector which is used to find or create a ClickDetector.

If ClickDetector is an ObjectValue, will use the .Value of the ObjectValue.

If ClickDetector is a BasePart, Model, or Folder:

  • Will try to get the ClickDetector child of it.
  • If a ClickDetector cannot be found, creates one.

constraintRestraint

RestraintPluginModule.constraintRestraint() → ()

Sets a Restraint to be animated to open and close via a HingeConstraint.

Restraint model must have a child named RestraintConstraint which is a HingeConstraint or is an ObjectValue whose value is the HingeConstraint

The Config interface is constructed as follows:

type Config = {
	openAngle: number,
	closedAngle: number, -- Angle while restraint is closed and seat is empty
	clampedAngle: number, -- Angle while restraint is closed and a character is seated in the seat
}

All values are in degrees, as they are used to set the .Angle value of the HingeConstraint.

Show raw api
{
    "functions": [
        {
            "name": "restraintsWithTag",
            "desc": "Creates a function which gets descendants from a Model\nwith the given tag.",
            "params": [
                {
                    "name": "tag",
                    "desc": "",
                    "lua_type": "string? = \"RESTRAINT\""
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(model: Model) -> {Instance}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 14,
                "path": "src/shared/plugins/restraint/restraintsWithTag.lua"
            }
        },
        {
            "name": "clickRestraint",
            "desc": "Sets a Restraint so that it can be open/closed by clicking on it via a ClickDetector\n\nRestraint model must have a child named `ClickDetector` which is used to find or create a `ClickDetector`.\n\nIf `ClickDetector` is an ObjectValue, will use the .Value of the ObjectValue.\n\nIf `ClickDetector` is a `BasePart`, `Model`, or `Folder`:\n- Will try to get the `ClickDetector` child of it.\n- If a `ClickDetector` cannot be found, creates one.",
            "params": [
                {
                    "name": "restraint",
                    "desc": "",
                    "lua_type": "Restraint"
                },
                {
                    "name": "clickDistance",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "validatePlayer",
                    "desc": "",
                    "lua_type": "((player: Player) -> boolean)?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "src/shared/plugins/restraint/clickRestraint.lua"
            }
        },
        {
            "name": "constraintRestraint",
            "desc": "Sets a Restraint to be animated to open and close via a HingeConstraint.\n\nRestraint model must have a child named `RestraintConstraint` which is a `HingeConstraint`\nor is an ObjectValue whose value is the `HingeConstraint`\n\nThe Config interface is constructed as follows:\n```lua\ntype Config = {\n\topenAngle: number,\n\tclosedAngle: number, -- Angle while restraint is closed and seat is empty\n\tclampedAngle: number, -- Angle while restraint is closed and a character is seated in the seat\n}\n```\n\nAll values are in *degrees*, as they are used to set the .Angle value of the HingeConstraint.",
            "params": [
                {
                    "name": "restraint",
                    "desc": "",
                    "lua_type": "Restraint"
                },
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "ConstraintRestraintConfig"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 36,
                "path": "src/shared/plugins/restraint/constraintRestraint.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "RestraintPlugin",
            "desc": "",
            "lua_type": "RestraintPlugin",
            "source": {
                "line": 8,
                "path": "src/shared/plugins/restraint/init.lua"
            }
        },
        {
            "name": "Restraint",
            "desc": "",
            "lua_type": "Restraint",
            "source": {
                "line": 12,
                "path": "src/shared/plugins/restraint/init.lua"
            }
        },
        {
            "name": "Restraint_Client",
            "desc": "",
            "lua_type": "Restraint_Client",
            "source": {
                "line": 16,
                "path": "src/shared/plugins/restraint/init.lua"
            }
        },
        {
            "name": "Restraint_Server",
            "desc": "",
            "lua_type": "Restraint_Server",
            "source": {
                "line": 20,
                "path": "src/shared/plugins/restraint/init.lua"
            }
        }
    ],
    "types": [
        {
            "name": "ConstraintRestraintConfig",
            "desc": "All values are in *degrees*, as they are used to set the .Angle value\nof the HingeConstraint.",
            "fields": [
                {
                    "name": "openAngle",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "closedAngle",
                    "lua_type": "number",
                    "desc": "Angle while restraint is closed and seat is empty"
                },
                {
                    "name": "clampedAngle",
                    "lua_type": "number",
                    "desc": "Angle while restraint is closed and a character is seated in the seat"
                }
            ],
            "source": {
                "line": 8,
                "path": "src/shared/plugins/restraint/constraintRestraint.lua"
            }
        }
    ],
    "name": "RestraintPluginModule",
    "desc": "Module for the RestraintPlugin",
    "source": {
        "line": 3,
        "path": "src/shared/plugins/restraint/init.lua"
    }
}