Player is not moving back and forth between wall (only left)

I have a player (green) and two walls red. I want the player to go back forth between wall when it collide with the wall.

I have platform behaviour on the walls and platform character behaviour on the player.

a global variable Direction

Skärmavbild 2025-06-28 kl. 17.03.40

My code

The player moves left but when I debug the variable never updates to right and player stops at the left wall.

2:42