Skip to main content

HumanoidMover

A Types.Mover for a model with a Humanoid and a PrimaryPart: walks each step with MoveTo, jumps at Jump steps, and gives up when the rig stops making progress for StuckTimeout seconds. Exposed as VluxyAI.Movers.Humanoid.

Roblox fires MoveToFinished(false) eight seconds after any MoveTo, reached or not, so a step further than eight seconds of walking would otherwise end a healthy walk. The mover re-issues the MoveTo for the same step while the stuck check sees progress and only gives up when the stuck check agrees.

Follows the two mover rules: Follow fires Arrived(false) for the path it replaces before starting the new one, and the new path is only ever reported from a later frame, because MoveToFinished never fires inside MoveTo.

Types​

MoverNoise​

interface MoverNoise {
Signal: NoiseSignal--

The noise signal a Hearing sense listens to. Fired with the rig as its source.

Interval: number?--

Seconds between noises while moving. Default 0.5.

Loudness: number | (speed: number) → number?--

The loudness fired, or a function of the current speed. Default 1.

}

Functions​

ChooseStart​

HumanoidMover.ChooseStart(
path: Path,
position: Vector3,--

Where the rig is.

skipDistance: number
) → number

MoverStart.Choose, kept here under its old name.

new​

HumanoidMover.new(
model: Model,--

Needs a PrimaryPart and a Humanoid child.

) → HumanoidMover

Types

​

interface HumanoidOptions {
Speed: number?--

WalkSpeed, studs per second. Default 16.

StuckTimeout: number?--

Seconds without moving StuckDistance before giving up. Default 3.

StuckDistance: number?--

Studs the root must move within StuckTimeout to count as progress. Default 0.5.

SkipDistance: number?--

Leading plain Walk steps within this horizontal distance of the rig are skipped. Default 1.

ReachDistance: number?--

MoveToFinished(true) only counts when the root is within this horizontal distance of the step it is walking to; a "reached" from farther away is a late event from a walk this path did not start, and the walk goes on. Default 4.

ServerOwned: boolean?--

Set the root's network owner to the server in new. Default true.

Noise: MoverNoise?--

Fire a Hearing noise signal every Interval seconds while walking, so other agents hear this one coming. Off by default.

}

Sets WalkSpeed to Speed and, with ServerOwned, hands the root to the server. That fails, with a warning, unless the model is a descendant of Workspace and unanchored before this call.

Errors

TypeDescription
stringThe model has no `PrimaryPart` or no `Humanoid`.
"unknown option"A key that is not in `HumanoidOptions`.

Follow​

HumanoidMover.Follow(
path: Path
) → ()

Starts along path, replacing any current one. The replaced path gets Arrived(false) before the new one starts; the new one is only ever reported from a later frame. An empty path is reported as Arrived(false) on the next Heartbeat.

Stop​

HumanoidMover.Stop(self: HumanoidMover) → ()

Cancels the walk. Fires Arrived(false) if a path was in progress.

Face​

HumanoidMover.Face(
position: Vector3?--

Where to face; nil to stop.

) → ()

Turns the root toward position every Heartbeat while no path is in progress, so a rig can stare at a player without walking. MoveTo steers while walking, so a path takes over and the facing resumes when it ends. Sets the root's CFrame, which is what a server-owned rig standing still expects.

SetNudge​

HumanoidMover.SetNudge(
offset: Vector3?--

Added to every step but the last; nil clears.

) → ()

A sideways push from a steering sense such as Neighbours. Re-issues the current MoveTo when the nudge changes, so the rig turns at once.

Teleport​

HumanoidMover.Teleport(
position: Vector3--

Where the root goes.

) → ()

Drops the current path (Arrived(false) if one was in progress) and pivots the model so its root sits at position, keeping its facing.

GetPosition​

HumanoidMover.GetPosition(self: HumanoidMover) → Vector3--

The PrimaryPart position.

GetSpeed​

HumanoidMover.GetSpeed(self: HumanoidMover) → number--

Studs per second.

SetSpeed​

HumanoidMover.SetSpeed(
studsPerSecond: number--

Becomes the humanoid's WalkSpeed.

) → ()

IsMoving​

HumanoidMover.IsMoving(self: HumanoidMover) → boolean--

true while a path is in progress.

Destroy​

HumanoidMover.Destroy(self: HumanoidMover) → ()

Stops, then drops the signals. The model is left alone; it is yours.

Show raw api
{
    "functions": [
        {
            "name": "ChooseStart",
            "desc": "[MoverStart.Choose], kept here under its old name.",
            "params": [
                {
                    "name": "path",
                    "desc": "",
                    "lua_type": "Path"
                },
                {
                    "name": "position",
                    "desc": "Where the rig is.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "skipDistance",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 139,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "new",
            "desc": "Sets `WalkSpeed` to `Speed` and, with `ServerOwned`, hands the root to the server. That fails,\nwith a warning, unless the model is a descendant of Workspace and unanchored before this call.",
            "params": [
                {
                    "name": "model",
                    "desc": "Needs a `PrimaryPart` and a `Humanoid` child.",
                    "lua_type": "Model"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "HumanoidOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HumanoidMover"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "string",
                    "desc": "The model has no `PrimaryPart` or no `Humanoid`."
                },
                {
                    "lua_type": "\"unknown option\"",
                    "desc": "A key that is not in `HumanoidOptions`."
                }
            ],
            "source": {
                "line": 154,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "Follow",
            "desc": "Starts along `path`, replacing any current one. The replaced path gets `Arrived(false)` before\nthe new one starts; the new one is only ever reported from a later frame. An empty path is\nreported as `Arrived(false)` on the next Heartbeat.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                },
                {
                    "name": "path",
                    "desc": "",
                    "lua_type": "Path"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 387,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "Stop",
            "desc": "Cancels the walk. Fires `Arrived(false)` if a path was in progress.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 422,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "Face",
            "desc": "Turns the root toward `position` every Heartbeat while no path is in progress, so a rig can\nstare at a player without walking. `MoveTo` steers while walking, so a path takes over and\nthe facing resumes when it ends. Sets the root's `CFrame`, which is what a server-owned rig\nstanding still expects.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                },
                {
                    "name": "position",
                    "desc": "Where to face; `nil` to stop.",
                    "lua_type": "Vector3?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 435,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "SetNudge",
            "desc": "A sideways push from a steering sense such as [Neighbours]. Re-issues the current `MoveTo`\nwhen the nudge changes, so the rig turns at once.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                },
                {
                    "name": "offset",
                    "desc": "Added to every step but the last; `nil` clears.",
                    "lua_type": "Vector3?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 467,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "Teleport",
            "desc": "Drops the current path (`Arrived(false)` if one was in progress) and pivots the model so its\nroot sits at `position`, keeping its facing.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                },
                {
                    "name": "position",
                    "desc": "Where the root goes.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 486,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "GetPosition",
            "desc": "",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                }
            ],
            "returns": [
                {
                    "desc": "The `PrimaryPart` position.",
                    "lua_type": "Vector3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 499,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "GetSpeed",
            "desc": "",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                }
            ],
            "returns": [
                {
                    "desc": "Studs per second.",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 507,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "SetSpeed",
            "desc": "",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                },
                {
                    "name": "studsPerSecond",
                    "desc": "Becomes the humanoid's `WalkSpeed`.",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 515,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "IsMoving",
            "desc": "",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                }
            ],
            "returns": [
                {
                    "desc": "`true` while a path is in progress.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 524,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Stops, then drops the signals. The model is left alone; it is yours.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "HumanoidMover"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 533,
                "path": "lib/Movers/Humanoid.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "HumanoidOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Speed",
                    "lua_type": "number?",
                    "desc": "`WalkSpeed`, studs per second. Default `16`."
                },
                {
                    "name": "StuckTimeout",
                    "lua_type": "number?",
                    "desc": "Seconds without moving `StuckDistance` before giving up. Default `3`."
                },
                {
                    "name": "StuckDistance",
                    "lua_type": "number?",
                    "desc": "Studs the root must move within `StuckTimeout` to count as progress. Default `0.5`."
                },
                {
                    "name": "SkipDistance",
                    "lua_type": "number?",
                    "desc": "Leading plain Walk steps within this horizontal distance of the rig are skipped. Default `1`."
                },
                {
                    "name": "ReachDistance",
                    "lua_type": "number?",
                    "desc": "`MoveToFinished(true)` only counts when the root is within this horizontal distance of the step it is walking to; a \"reached\" from farther away is a late event from a walk this path did not start, and the walk goes on. Default `4`."
                },
                {
                    "name": "ServerOwned",
                    "lua_type": "boolean?",
                    "desc": "Set the root's network owner to the server in `new`. Default `true`."
                },
                {
                    "name": "Noise",
                    "lua_type": "MoverNoise?",
                    "desc": "Fire a [Hearing] noise signal every `Interval` seconds while walking, so other agents hear this one coming. Off by default."
                }
            ],
            "source": {
                "line": 87,
                "path": "lib/Movers/Humanoid.luau"
            }
        },
        {
            "name": "MoverNoise",
            "desc": "",
            "fields": [
                {
                    "name": "Signal",
                    "lua_type": "NoiseSignal",
                    "desc": "The noise signal a [Hearing] sense listens to. Fired with the rig as its source."
                },
                {
                    "name": "Interval",
                    "lua_type": "number?",
                    "desc": "Seconds between noises while moving. Default `0.5`."
                },
                {
                    "name": "Loudness",
                    "lua_type": "number | (speed: number) -> number?",
                    "desc": "The loudness fired, or a function of the current speed. Default `1`."
                }
            ],
            "source": {
                "line": 95,
                "path": "lib/Movers/Humanoid.luau"
            }
        }
    ],
    "name": "HumanoidMover",
    "desc": "A [Types.Mover] for a model with a `Humanoid` and a `PrimaryPart`: walks each step with\n`MoveTo`, jumps at `Jump` steps, and gives up when the rig stops making progress for\n`StuckTimeout` seconds. Exposed as `VluxyAI.Movers.Humanoid`.\n\nRoblox fires `MoveToFinished(false)` eight seconds after any `MoveTo`, reached or not, so a step\nfurther than eight seconds of walking would otherwise end a healthy walk. The mover re-issues\nthe `MoveTo` for the same step while the stuck check sees progress and only gives up when the\nstuck check agrees.\n\nFollows the two mover rules: `Follow` fires `Arrived(false)` for the path it replaces before\nstarting the new one, and the new path is only ever reported from a later frame, because\n`MoveToFinished` never fires inside `MoveTo`.",
    "source": {
        "line": 126,
        "path": "lib/Movers/Humanoid.luau"
    }
}