Skip to main content

ClientObjects

This item only works when running on the client. Client

A table of utility functions for working with Client Objects that can be used to speed up the process of writing repository scripts for client objects.

Functions​

isButtonActivatedPlatform​

shorthand
ClientObjects.isButtonActivatedPlatform(platform: Instance) → boolean

This function is used to check if the provided Instance is a ButtonActivatedPlatform.

This will return true if it is a BasePart and meets one of the following requirements:

  • Is named ButtonActivatedPlatform
  • Has a tag named ButtonActivated

isBalloon​

shorthand
ClientObjects.isBalloon(
parent: Instance,
doNotCheckAncestor: boolean?
) → boolean

This function is used to check if the provided Instance is part of a dispensed Balloon.

This will return true if it meets one of the following requirements:

  • Is named BalloonModel
  • If doNotCheckAncestor is not true and the Instance has an ancestor named BalloonModel

isTurret​

shorthand
ClientObjects.isTurret(
parent: Instance,
doNotCheckAncestor: boolean?
) → boolean

This function is used to check if the provided Instance is part of a Turret's bullet.

This will return true if it meets one of the following requirements:

  • Is named Bullet
  • If doNotCheckAncestor is not true and the Instance has an ancestor named Bullet

isPushbox​

shorthand
ClientObjects.isPushbox(
parent: Instance,
doNotCheckAncestor: boolean?
) → boolean

This function is used to check if the provided Instance is part of a Pushbox. This will return true if it meets one of the following requirements:

  • Is named Pushbox
  • Has a tag named IsBox
  • If doNotCheckAncestor is not true and the Instance has an ancestor named Pushbox

validatePlayerToucher​

ClientObjects.validatePlayerToucher(
toucher: BasePart,
mode: Character.HitboxModes?
) → boolean

This function checks if the given toucher is part of the character's hitbox mode provided.

evaluateToucher​

ClientObjects.evaluateToucher(
part: BasePart,
toucher: BasePart,
config: (Instance | typeof(Config.TOUCH_CONFIG))?
) → boolean

This function checks if two BaseParts (part and toucher) touching is considered valid or not, based on the provided config.

See this page for more info.

bindToFlip​

ClientObjects.bindToFlip(
part: BasePart,
callback: (rootPart: BasePart) → ()
) → () → ()

Binds the callback function to the part, executing the callback when the player performs a corner flip on it.

formatTimerText​

ClientObjects.formatTimerText(
text: string,
decimalPlaces: number,
timeRemaining: number
) → string

Function to format timer labels in a standardized manner, used in Buttons and Morphers. Below are special codes that are replaced within the string automatically.

Code Replaced with:
{T} The time left on the timer, modified with TimerDecimalPlaces
{M} The minutes left on the timer
{S} The seconds left on the timer
{MS} The milliseconds left on the timer
{SM} Used for grammatical reasons. When the amount of minutes left is equal to one, this will display the letter "s", otherwise this will display nothing. e.g. "minute{SM}" will either display "minutes" or "minute".
{SS} Used for grammatical reasons. When the amount of seconds left is equal to one, this will display the letter "s", otherwise this will display nothing. e.g. "second{SM}" will either display "seconds" or "second".
{Pn} The player's username
{pn} The username in all lowercase
{PN} The username in all UPPERCASE
{Dn} The player's Display Name
{dn} The Display Name in all lowercase
{DN} The Display Name in all UPPERCASE
{UID} The player's User ID

isInstanceActive​

ClientObjects.isInstanceActive(
scope: Scope,
instance: Instance,
ignoreList: {[string]: boolean}?
) → boolean

Returns whether the provided Instance is active or not.

listenInstanceActive​

ClientObjects.listenInstanceActive(
scope: Scope,
instance: Instance,
ignoreList: {[string]: boolean}?,
callback: (active: boolean) → ()
) → () → ()

Listens to the Instance's activeness, executing the callback when it's activeness changes.

setInstanceActive​

ClientObjects.setInstanceActive(
scope: Scope,
instance: Instance,
key: string,
active: boolean
) → ()

Sets the Instance's activeness based on active. Instances can have multiple activeness states, dictated by the key parameter.

getCOVersion​

ClientObjects.getCOVersion(config: Instance) → string

This function returns the current version of the Client Object. The version only changes between versions when changes are made to a repository script.

isVersionOrHigher​

ClientObjects.isVersionOrHigher(
currentVersion: string,
targetVersion: string
) → boolean

This function returns whether the currentVersion is equal or above the targetVersion. Versions are defined in-order in the VERSION_LIST table.

scanFolder​

ClientObjects.scanFolder(
targetScope: Scope,
path: Instance,
targetPath: Instance?
) → ()

Scans the given folder and loads any client objects within into the given scope. Used for client objects that can spawn other client objects, such as Pushboxes.

Show raw api
{
    "functions": [
        {
            "name": "isButtonActivatedPlatform",
            "desc": "This function is used to check if the provided `Instance`\nis a ButtonActivatedPlatform.\n\nThis will return `true` if it is a `BasePart` and meets\none of the following requirements:\n\t\n* Is named `ButtonActivatedPlatform`\n* Has a tag named `ButtonActivated`",
            "params": [
                {
                    "name": "platform",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 39,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "isBalloon",
            "desc": "This function is used to check if the provided `Instance` \nis part of a dispensed Balloon.\n\nThis will return `true` if it meets one of the following requirements:\n\t\n* Is named `BalloonModel`\n* If `doNotCheckAncestor` is not `true` and the `Instance` has an ancestor\nnamed `BalloonModel`",
            "params": [
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "doNotCheckAncestor",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 60,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "isTurret",
            "desc": "This function is used to check if the provided `Instance` \nis part of a Turret's bullet.\n\nThis will return `true` if it meets one of the following requirements:\n\n* Is named `Bullet`\n* If `doNotCheckAncestor` is not `true` and the `Instance` has an ancestor\nnamed `Bullet`\n\t",
            "params": [
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "doNotCheckAncestor",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 82,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "isPushbox",
            "desc": "This function is used to check if the provided `Instance` \nis part of a Pushbox.\nThis will return `true` if it meets one of the following requirements:\n\n* Is named `Pushbox`\n* Has a tag named `IsBox`\n* If `doNotCheckAncestor` is not `true` and the `Instance` has an ancestor\nnamed `Pushbox`",
            "params": [
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "doNotCheckAncestor",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 104,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "validatePlayerToucher",
            "desc": "This function checks if the given `toucher` is part of the character's hitbox mode provided.",
            "params": [
                {
                    "name": "toucher",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "mode",
                    "desc": "",
                    "lua_type": "Character.HitboxModes?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 118,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "evaluateToucher",
            "desc": "This function checks if two `BasePart`s (`part` and `toucher`) touching\nis considered valid or not, based on the provided `config`.\n\nSee [this page](/docs/global-configurations/touch-configurations) for more info.",
            "params": [
                {
                    "name": "part",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "toucher",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "(Instance | typeof(Config.TOUCH_CONFIG))?\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 141,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "bindToFlip",
            "desc": "Binds the `callback` function to the `part`, executing the callback when\nthe player performs a corner flip on it.",
            "params": [
                {
                    "name": "part",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(rootPart: BasePart) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 187,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "formatTimerText",
            "desc": "Function to format timer labels in a standardized manner, used in Buttons and Morphers.\nBelow are special codes that are replaced within the string automatically.\n\n|  Code  | Replaced with: |\n|--------|---------------------------|\n| `{T}` | The time left on the timer, modified with `TimerDecimalPlaces` |\n| `{M}` | The minutes left on the timer |\n| `{S}` | The seconds left on the timer |\n| `{MS}` | The milliseconds left on the timer |\n| `{SM}` | Used for grammatical reasons. When the amount of minutes left is equal to one, this will display the letter \"s\", otherwise this will display nothing. e.g. \"minute{SM}\" will either display \"minutes\" or \"minute\". |\n| `{SS}` | Used for grammatical reasons. When the amount of seconds left is equal to one, this will display the letter \"s\", otherwise this will display nothing. e.g. \"second{SM}\" will either display \"seconds\" or \"second\". |\n| `{Pn}` | The player's username |\n| `{pn}` | The username in all lowercase |\n| `{PN}` | The username in all UPPERCASE |\n| `{Dn}` | The player's Display Name |\n| `{dn}` | The Display Name in all lowercase |\n| `{DN}` | The Display Name in all UPPERCASE |\n| `{UID}` | The player's User ID |",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "decimalPlaces",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "timeRemaining",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 213,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "isInstanceActive",
            "desc": "Returns whether the provided `Instance` is active or not.",
            "params": [
                {
                    "name": "scope",
                    "desc": "",
                    "lua_type": "Scope"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "ignoreList",
                    "desc": "",
                    "lua_type": "{ [string]: boolean }?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 247,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "listenInstanceActive",
            "desc": "Listens to the `Instance`'s activeness, executing the `callback` when\nit's activeness changes.",
            "params": [
                {
                    "name": "scope",
                    "desc": "",
                    "lua_type": "Scope"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "ignoreList",
                    "desc": "",
                    "lua_type": "{ [string]: boolean }?"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(active: boolean) -> ()\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 284,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "setInstanceActive",
            "desc": "Sets the `Instance`'s activeness based on `active`.\nInstances can have multiple activeness states, dictated by the `key` parameter.",
            "params": [
                {
                    "name": "scope",
                    "desc": "",
                    "lua_type": "Scope"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "active",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 306,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "getCOVersion",
            "desc": "This function returns the current version of the Client Object.\nThe version only changes between versions when changes are made\nto a repository script.",
            "params": [
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 341,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "isVersionOrHigher",
            "desc": "This function returns whether the `currentVersion` is equal or above the\n`targetVersion`. Versions are defined in-order in the `VERSION_LIST` table.",
            "params": [
                {
                    "name": "currentVersion",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "targetVersion",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 357,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        },
        {
            "name": "scanFolder",
            "desc": "Scans the given folder and loads any client objects within into the given scope.\nUsed for client objects that can spawn other client objects, such as Pushboxes.",
            "params": [
                {
                    "name": "targetScope",
                    "desc": "",
                    "lua_type": "Scope"
                },
                {
                    "name": "path",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "targetPath",
                    "desc": "",
                    "lua_type": "Instance?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 376,
                "path": "mirror/Kit.Utility.ClientObjects.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ClientObjects",
    "desc": "A table of utility functions for working with Client Objects that can be used to speed up the process of writing repository scripts for client objects.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 12,
        "path": "mirror/Kit.Utility.ClientObjects.luau"
    }
}