Skip to main content

Functions

This item only works when running on the client. Client

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

Functions

generateUID

shorthand
Functions.generateUID(curlyBracesboolean?) → string

Shorthand for HttpService:GenerateGUID().

utility.generateUID()
--> 4BA80F4637244B4BBA957E28B9443DE9

tween

shorthand
Functions.tween(
instanceInstance,
confignumber | typeof(Config.TWEEN_CONFIG),
goal{[string]any},
easingStyleEnum.EasingStyle?,--

EasingStyle

easingDirectionEnum.EasingDirection?,--

EasingDirection

...any
) → Tween

Simple tween function that handles garbage collection properly.

utility.tween(part, 0.5, {
    Color = Color3.fromRGB(255, 0, 0)
})

playSoundFromInstance

Functions.playSoundFromInstance(
instanceInstance,
containerInstance,
soundNamestring,
fallbackSoundSound?
) → Sound?

Plays a sound with the given soundName from the given container at the instance's location. If the sound doesn't exist, fallbackSound will be used instead if set.

roundColor

shorthand
Functions.roundColor(colorColor3) → Color3

Rounds the provided color to remedy rounding errors that cause issues on some devices when comparing two Color3 values.

yieldTimeout

Functions.yieldTimeout(
timeoutnumber,
fn(A...) → T...,
...A...
) → T...

Runs a function, and cancels it after the specified timeout duration if it hasn't finished by then.

Show raw api
{
    "functions": [
        {
            "name": "generateUID",
            "desc": "Shorthand for [HttpService:GenerateGUID()](https://create.roblox.com/docs/reference/engine/classes/HttpService#GenerateGUID). \n\n```lua\nutility.generateUID()\n--> 4BA80F4637244B4BBA957E28B9443DE9\n```",
            "params": [
                {
                    "name": "curlyBraces",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 28,
                "path": "mirror/Kit.Utility.Functions.luau"
            }
        },
        {
            "name": "tween",
            "desc": "Simple tween function that handles garbage collection properly.\n\n```lua\nutility.tween(part, 0.5, {\n    Color = Color3.fromRGB(255, 0, 0)\n})\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "number | typeof(Config.TWEEN_CONFIG)"
                },
                {
                    "name": "goal",
                    "desc": "",
                    "lua_type": "{ [string]: any }"
                },
                {
                    "name": "easingStyle",
                    "desc": "[EasingStyle](https://create.roblox.com/docs/reference/engine/enums/EasingStyle)",
                    "lua_type": "Enum.EasingStyle?"
                },
                {
                    "name": "easingDirection",
                    "desc": "[EasingDirection](https://create.roblox.com/docs/reference/engine/enums/EasingDirection)",
                    "lua_type": "Enum.EasingDirection?"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Tween\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 46,
                "path": "mirror/Kit.Utility.Functions.luau"
            }
        },
        {
            "name": "playSoundFromInstance",
            "desc": "Plays a sound with the given `soundName` from the given `container`\nat the `instance`'s location. If the sound doesn't exist, `fallbackSound`\nwill be used instead if set.",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "container",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "soundName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "fallbackSound",
                    "desc": "",
                    "lua_type": "Sound?\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Sound?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 80,
                "path": "mirror/Kit.Utility.Functions.luau"
            }
        },
        {
            "name": "roundColor",
            "desc": "Rounds the provided `color` to remedy rounding errors that cause issues\non some devices when comparing two `Color3` values.",
            "params": [
                {
                    "name": "color",
                    "desc": "",
                    "lua_type": "Color3"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Color3\n"
                }
            ],
            "function_type": "static",
            "tags": [
                "shorthand"
            ],
            "source": {
                "line": 105,
                "path": "mirror/Kit.Utility.Functions.luau"
            }
        },
        {
            "name": "yieldTimeout",
            "desc": "Runs a function, and cancels it after the specified timeout duration if it\nhasn't finished by then.",
            "params": [
                {
                    "name": "timeout",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "fn",
                    "desc": "",
                    "lua_type": "(A...) -> T..."
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "A..."
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T...\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 115,
                "path": "mirror/Kit.Utility.Functions.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Functions",
    "desc": "A table of utility functions that can be used to speed up the process of writing repository scripts for client objects.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 14,
        "path": "mirror/Kit.Utility.Functions.luau"
    }
}