Change Walkspeed from component

I have a component that I want to be able to modify the character’s UCharacterMovementComponent to adjust the Max walk speed, but I don’t know how to access the other components of the character that this component is attached to.

Any help would be appreciated

auto* CharacterMovementComponent = GetOwner()->FindComponentByClass()

GetOwner() … gets you the Actor that the component is on
FindComponentByClass() … is a templated get component call, which returns a pointer to the UCharacterMovementComponent if one exists other wise nullptr

The easiest way to go in this case is:

GetCharacterMovement()->MaxWalkSpeed = WalkSpeed;

I swear I tried this and it didn’t work. Maybe VS was acting wierd. This worked perfectly, thanks for your help!