PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

Move

This function causes the Humanoid to walk in the given DataType/Vector3 direction.

By default, the direction given is in world terms. If the relativeToCamera parameter is true however the direction given is relative to the Workspace/CurrentCamera|CurrentCamera’s DataType/CFrame. As the negative Z direction is considered ‘forwards’ in Roblox, the following code would make the Humanoid walk in the direction of the Workspace/CurrentCamera.

humanoid:Move(Vector3.new(0, 0, -1), true)

When this function is called, the Humanoid will move until the function is called again. However, if the default control scripts are being used this function will be overwritten when called on Player Player/Character|Characters. This can be avoided by either not using the default control scripts, or calling this function every frame using RunService/BindToRenderStep (see example).

This function can be called on the server, but this should only be done when the server has network ownership of the Humanoid|Humanoid’s assembly.

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

No return


Code Samples


Moving a Humanoid Forwards

This code sample uses the Humanoid/Move function to make the Player|Player’s Player/Character|Character to walk in the direction of the Camera.

RunService/BindToRenderStep is required here as the default control scripts will overwrite the player’s movement every frame.

To run this sample, place it inside a LocalScript parented to StarterCharacterScripts|StarterPlayer.StarterCharacterScripts.