To start, I would recommend moving the player variable declaration to outside of the loop. You'll have to make this an onready variable.
It looks like the problem with your code is that you're not using the motion variable. You declare it, but you don't change it. Instead, you are changing the position directly. I would use
var motion = Vector2.ZERO
motion += position.direction_to(player.position)
and instead of using
motion = move_and_slide(motion)
You can also add the
look_at(player.position) line here if you want
That's it! Let me know if this works for you. I've tested this and it works in my games.