Skip to main content

Conditions

Conditions can be used in systems or as Run Conditions.

Functions

timePassed

Conditions.timePassed(
timenumber--

Time in seconds

) → hasTimePassed() → boolean

A Throttle condition which checks whether the amount of time given has passed or not.

runOnce

Conditions.runOnce() → hasRanOnce() → boolean

Checks whether the condition has been called once before

onEvent

Conditions.onEvent(
instanceEventInstance | EventLike,
eventstring | EventLike
) → (
hasNewEvent() → boolean,
collectEvents() → () → (
number,
U...
),
getDisconnectFn() → () → ()
)

Checks for any new events and allows for the collection of those events.

isNot

Conditions.isNot(
condition() → boolean,
...any
) → inverseCondition() → boolean

Inverses a given condition.

Show raw api
{
    "functions": [
        {
            "name": "timePassed",
            "desc": "A Throttle condition which checks whether the amount of\ntime given has passed or not.\r",
            "params": [
                {
                    "name": "time",
                    "desc": "Time in seconds",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "hasTimePassed () -> boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "src/conditions.luau"
            }
        },
        {
            "name": "runOnce",
            "desc": "Checks whether the condition has been called once before\r",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "hasRanOnce () -> boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 37,
                "path": "src/conditions.luau"
            }
        },
        {
            "name": "onEvent",
            "desc": "Checks for any new events and allows for the collection of\nthose events.\r",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "EventInstance | EventLike"
                },
                {
                    "name": "event",
                    "desc": "",
                    "lua_type": "string | EventLike\r\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "hasNewEvent () -> boolean"
                },
                {
                    "desc": "",
                    "lua_type": "collectEvents () -> () -> (number, U...)"
                },
                {
                    "desc": "",
                    "lua_type": "getDisconnectFn () -> () -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 69,
                "path": "src/conditions.luau"
            }
        },
        {
            "name": "isNot",
            "desc": "Inverses a given condition.\r",
            "params": [
                {
                    "name": "condition",
                    "desc": "",
                    "lua_type": "() -> boolean"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "inverseCondition () -> boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 136,
                "path": "src/conditions.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Conditions",
    "desc": "Conditions can be used in systems or as Run Conditions.\r",
    "source": {
        "line": 13,
        "path": "src/conditions.luau"
    }
}