Skip to main content

InstanceUtil

A Util object that gives some nice methods for when a macro needs to create instances + place them somewhere in the workspace. It places instances under a Socket folder, under this specific user - useful for Team Create!

Instances parented using this class will be automatically cleaned up when Socket closes (but only for the specific user in Team Create). You may still want to have a BindToClose implementation, depending on what your macro does and if you need to handle cases where the plugin isn't closed properly (e.g., Studio crash)

This can be required under game.ServerStorage.SocketPlugin.Utils.InstanceUtil

Functions

IntroduceInstance

InstanceUtil:IntroduceInstance(
instanceInstance,
dontSetWaypointboolean | nil
) → ()

Brings an instance into the workspace in the context of Socket and the user calling this function. By default, sets a ChangeHistoryService waypoint.

ClearInstance

InstanceUtil:ClearInstance(
instanceInstance,
doDestroyboolean
) → ()

Clears an instance from our context of Socket and the user calling this function. Should be an instance that was introduced via IntroduceInstance

Show raw api
{
    "functions": [
        {
            "name": "IntroduceInstance",
            "desc": "Brings an instance into the workspace in the context of Socket and the user calling this function. By default, sets a ChangeHistoryService waypoint.",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "dontSetWaypoint",
                    "desc": "",
                    "lua_type": "boolean|nil"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 49,
                "path": "docs_api/utils.lua"
            }
        },
        {
            "name": "ClearInstance",
            "desc": "Clears an instance from our context of Socket and the user calling this function. Should be an instance that was introduced via `IntroduceInstance`",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "doDestroy",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 58,
                "path": "docs_api/utils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "InstanceUtil",
    "desc": "A Util object that gives some nice methods for when a macro needs to create instances + place them somewhere in the workspace. It places instances\nunder a Socket folder, under this specific user - useful for Team Create!\n\nInstances parented using this class will be automatically cleaned up when Socket closes (but only for the specific user in Team Create). You may still want to have a `BindToClose` implementation,\ndepending on what your macro does and if you need to handle cases where the plugin isn't closed properly (e.g., Studio crash)\n\nThis can be required under `game.ServerStorage.SocketPlugin.Utils.InstanceUtil`",
    "source": {
        "line": 40,
        "path": "docs_api/utils.lua"
    }
}