That is not a P control, thats a bunch of if statements that also use VEX’s internal PID due to “setVelocity”.
If you want a P control do something along the lines of
double kP = 0.001;
int error = 0;
int targetValue = 900;
while(1==1){
error = TrayPusher.rotation(degrees) - targetValue;
TrayPusher.spin( directionType::fwd, error * kP, voltageUnits::volt );
vex::task::sleep();
}
Using voltage would be better, so you have more control of how you operate the motor. You may need to switch things around so the P control loop works.