Skip to main content

Footsteps

Footstep audio from how far a rig actually walks. Exposed as VluxyAI.Animator.Footsteps (the client-side twin of Locomotion). Attach it to the rig a Replica moves and destroy it with the replica:

-- client, in the game's replica setup
local steps = VluxyAI.Animator.Footsteps.Attach(replica.Entity, { Sound = 9114234567, Stride = 2.5 })
replica.Destroyed:Connect(function() steps:Destroy() end)

For the enemies to hear each other's steps, give the mover a Noise option; that is the server's business and this is the player's ears.

Functions​

Attach​

Footsteps.Attach(
target: PVInstance,--

The rig: a Model with a PrimaryPart, or a BasePart. Anything with GetPivot and a PrimaryPart works in a test.

) → Cleaner--

Destroy it to stop; the sound instance goes with it.

Types

​

interface FootstepsOptions {
Sound: Sound | number?--

A Sound to clone under the root, or an asset id to make one from. Leave it out with OnStep.

Stride: number?--

Studs of floor travel between steps. Default 3.

Volume: number?--

Applied to a sound made from an id. Default 0.5.

MinSpeed: number?--

Studs per second below which no steps play, so a nudge or a settle is silent. Default 0.5.

PitchVariation: number?--

Random spread of PlaybackSpeed around 1, so steps do not sound stamped. Default 0.1.

OnStep: ((
position: Vector3,
root: BasePart?
) → ())?--

Called on every step, with or without a Sound: pick a sound by material here.

Random: Random?--

For the pitch. Default a new one.

}

Watches the pivot every Heartbeat and plays a step each Stride studs of horizontal travel while the rig is moving faster than MinSpeed.

Errors

TypeDescription
stringNeither `Sound` nor `OnStep` given.
Show raw api
{
    "functions": [
        {
            "name": "Attach",
            "desc": "Watches the pivot every Heartbeat and plays a step each `Stride` studs of horizontal travel\nwhile the rig is moving faster than `MinSpeed`.",
            "params": [
                {
                    "name": "target",
                    "desc": "The rig: a Model with a PrimaryPart, or a BasePart. Anything with `GetPivot` and a `PrimaryPart` works in a test.",
                    "lua_type": "PVInstance"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "FootstepsOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "Destroy it to stop; the sound instance goes with it.",
                    "lua_type": "Cleaner"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "string",
                    "desc": "Neither `Sound` nor `OnStep` given."
                }
            ],
            "source": {
                "line": 129,
                "path": "lib/Animator/Footsteps.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "FootstepsOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Sound",
                    "lua_type": "Sound | number?",
                    "desc": "A `Sound` to clone under the root, or an asset id to make one from. Leave it out with `OnStep`."
                },
                {
                    "name": "Stride",
                    "lua_type": "number?",
                    "desc": "Studs of floor travel between steps. Default `3`."
                },
                {
                    "name": "Volume",
                    "lua_type": "number?",
                    "desc": "Applied to a sound made from an id. Default `0.5`."
                },
                {
                    "name": "MinSpeed",
                    "lua_type": "number?",
                    "desc": "Studs per second below which no steps play, so a nudge or a settle is silent. Default `0.5`."
                },
                {
                    "name": "PitchVariation",
                    "lua_type": "number?",
                    "desc": "Random spread of `PlaybackSpeed` around `1`, so steps do not sound stamped. Default `0.1`."
                },
                {
                    "name": "OnStep",
                    "lua_type": "((position: Vector3, root: BasePart?) -> ())?",
                    "desc": "Called on every step, with or without a `Sound`: pick a sound by material here."
                },
                {
                    "name": "Random",
                    "lua_type": "Random?",
                    "desc": "For the pitch. Default a new one."
                }
            ],
            "source": {
                "line": 42,
                "path": "lib/Animator/Footsteps.luau"
            }
        }
    ],
    "name": "Footsteps",
    "desc": "Footstep audio from how far a rig actually walks. Exposed as `VluxyAI.Animator.Footsteps`\n(the client-side twin of [Locomotion]). Attach it to the rig a [Replica] moves and destroy\nit with the replica:\n\n```lua\n-- client, in the game's replica setup\nlocal steps = VluxyAI.Animator.Footsteps.Attach(replica.Entity, { Sound = 9114234567, Stride = 2.5 })\nreplica.Destroyed:Connect(function() steps:Destroy() end)\n```\n\nFor the enemies to hear each other's steps, give the mover a `Noise` option; that is the\nserver's business and this is the player's ears.",
    "source": {
        "line": 80,
        "path": "lib/Animator/Footsteps.luau"
    }
}