PlayerMovementModule controls how the local player walks, jumps, and zooms.
Available as the global PlayerMovementModule in LocalScripts.
Scripts that read or write this module error with LocalScripts only.
Overview
Properties
- .Gravity : number
- .WalkSpeed : number
- .JumpPower : number
- .MovementMode : string
- .CameraDistanceMin : number
- .CameraDistanceMax : number
- .CameraPos : Vector3
- .CameraRot : Vector3
API
Properties
Gravity
Gravity : number
Vertical acceleration applied while the player is in the air.
Default is -190. Set to 0 for no fall.
WalkSpeed
WalkSpeed : number
Horizontal speed in studs per second while MovementMode is "Default".
Default is 16.
JumpPower
JumpPower : number
Upward velocity applied on jump while MovementMode is "Default".
Default is 60.
JumpImpulse is an alias of this property.
MovementMode
MovementMode : string
"Default" uses engine WASD, analog stick, and jump.
"Scripted" turns those off. Gravity and collision still run unless Gravity is 0.
Move by writing `Character.Velocity` or `Character.Position`.
PlayerMovementModule.MovementMode = "Scripted"
PlayerMovementModule.Gravity = 0
RunModule.Frame:Connect(function(dt)
local v = Character.Velocity
if InputModule:IsKeyDown("W") then
Character.Velocity = Vector3.new(v.X, v.Y, v.Z - 20)
end
end)
CameraDistanceMin
CameraDistanceMin : number
Closest orbit zoom, in studs. Default is 0 (first person).
CameraDistanceMax
CameraDistanceMax : number
Farthest orbit zoom, in studs. Default is 20.
Does not apply while `CameraModule.Override` is true.
CameraPos
CameraPos : Vector3
World position of the local camera eye. Same value as `CameraModule.Position`.
Writing this turns camera Override on.
CameraRot
CameraRot : Vector3
Camera look angles in degrees. X is Yaw, Y is Pitch, Z is Roll.
Same value as `CameraModule.Rotation`.
Writing this turns camera Override on.
local look = PlayerMovementModule.CameraRot
print(look.X, look.Y) -- yaw, pitch
