Humanoid.MoveDirection returning 0 after player reset

hi so what i want to do is get the move direction on the server so i did this

while true do
		task.wait()
		local moveDirection = character.Humanoid.MoveDirection
print(moveDirection)
	end

the problemis that at first it works normally and it returns the move direction as normal but when i reset it will only return 0 (this is a server script)

you’ll have to reassign the character variable to the player’s new character thats created when they respawn