PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Move

This function causes the Humanoid to walk in the given direction.

When used on a NPC (Non Player Character) this function will cause the Humanoid to move until it is called again.
This function can be called on the client and the server, but the relativeToCamera paramater will not work correctly on the server as it has no Camera.

For Player Player/Character|Characters however this function needs calling every frame as the default control scripts overwrite it. This should be run from a LocalScript on the client. See below for an example:

RunService:BindToRenderStep("move",
    -- run after the character
    Enum.RenderPriority.Character.Value + 1,
    function()
        if localPlayer.Character then
            -- can save the below by using localPlayer:Move() instead
            local humanoid = localPlayer.Character:FindFirstChild("Humanoid")
            if humanoid then
                humanoid:Move(Vector3.new(0, 0, -1), true)
            end
        end
    end
)

See also

  • To make aHumanoid walk to a point, use the Humanoid/MoveTo function
  • For Player|Players the Player/Move|Player:Move function exists that calls this function

Parameters

Name Type Default Description

The direction to walk in

false

True if the direction parameter should be taken as relative to the Workspace/CurrentCamera

Returns

Return Type Summary