MaxWalkSpeed C++ problem

The code in “//” work i just want to know if there is a way that “- or +” work with that

MaxWalkSpeed is a variable, so when you say


Character->GetCharacterMovement()->MaxWalkSpeed - 300

You are subtracting 300 from whatever value is in MaxWalkSpeed, but you aren’t actually doing anything with that result (which is why the compiler is complaining).

If you wanted to store that value you could do:


Character->GetCharacterMovement()->MaxWalkSpeed = Character->GetCharacterMovement()->MaxWalkSpeed - 300

or even more succinctly


Character->GetCharacterMovement()->MaxWalkSpeed -= 300

Thanks man I thought since I already gave a speed In-Game C++ will know, but I forget that I have to get first the “walkspeed” then subtract it.