Humanoid.MoveDirection is always 0?

So I am working on a camera system for my game.
And it only does a certain something when they are moving.

So I am using Humanoid.MoveDirection.Magnitude.
But it is always equal to 0.
So:

  • Can anyone tell me why this is happening?
  • Is this going to happen sense I am using a custom character?
  • If it is cause I am using a custom character, how do I tell if they are walking?

Code


local walkingFov = 81
local standingFov = 31


local function IsPlayerMoving() --function
	
	if Player.Team == game:GetService('Teams'):FindFirstChild('Playing') then
		camPart.CFrame = CFrame.new(Player.Character.PrimaryPart.Position) * CFrame.new(0,0,mod.Camra.distance)
		cam.CameraType = Enum.CameraType.Scriptable
		cam.CFrame = camPart.CFrame
		warn(Humanoid.MoveDirection.Magnitude)
		if Humanoid.MoveDirection.Magnitude > 0 then
			if cam.FieldOfView >= standingFov then
				cam.FieldOfView -= 1
			end
			--print('Standing')
		else
			--print('Moving')
			if cam.FieldOfView <= walkingFov then
				cam.FieldOfView += 1

			end
		end
	end
end

RunService.RenderStepped:Connect(IsPlayerMoving) --running the function

iirc, it should error if you request the same service multiple times. Try requesting it at the top of the script and see what happens.