Skip to main content

ComplexRegions

Properties

Region

ComplexRegions.Region: Region

The Region class is exposed on the API but should typically be instantiated with the createRegion function.

local regionInstance = Instance.new("Part")
local region = ComplexRegions.Region.new(regionInstance)

Functions

createRegion

ComplexRegions.createRegion(
regionInstance: Model | BasePart,--

The instance that represents the region

whitelist: {Instance}--

Array of Instances that will trigger the region's events

) → Region

Helper function that will create a Region, set its whitelist, and also listen for instances entering and leaving.

Usage:

local region = ComplexRegions.createRegion(workspace.Region, {
	Players.LocalPlayer.Character
})

region.entered:Connect(function(instance: Instance)
	print(instance, "entered the region")
end)

region.left:Connect(function(instance: Instance)
	print(instance, "left the region")
end)
Show raw api
{
    "functions": [
        {
            "name": "createRegion",
            "desc": "Helper function that will create a Region, set its whitelist, and also\nlisten for instances entering and leaving.\n\nUsage:\n\n```lua\nlocal region = ComplexRegions.createRegion(workspace.Region, {\n\tPlayers.LocalPlayer.Character\n})\n\nregion.entered:Connect(function(instance: Instance)\n\tprint(instance, \"entered the region\")\nend)\n\nregion.left:Connect(function(instance: Instance)\n\tprint(instance, \"left the region\")\nend)\n```",
            "params": [
                {
                    "name": "regionInstance",
                    "desc": "The instance that represents the region",
                    "lua_type": "Model | BasePart"
                },
                {
                    "name": "whitelist",
                    "desc": "Array of Instances that will trigger the region's events",
                    "lua_type": "{ Instance }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Region"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "src/createRegion.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Region",
            "desc": "The Region class is exposed on the API but should typically be instantiated\nwith the `createRegion` function.\n\n```lua\nlocal regionInstance = Instance.new(\"Part\")\nlocal region = ComplexRegions.Region.new(regionInstance)\n```",
            "lua_type": "Region",
            "source": {
                "line": 17,
                "path": "src/init.lua"
            }
        }
    ],
    "types": [],
    "name": "ComplexRegions",
    "desc": "",
    "source": {
        "line": 4,
        "path": "src/init.lua"
    }
}