The sustain pedal records into an automation channel... if it messes up like it did then you can open the automation up and either adjust the on/off points or full on add them in. If you start to record with the pedal already depressed then it won't send a signal to change the state of the sustain automation. You need to hit record, play your first notes and THEN, push the pedal.
Thank you! And ive tried multiple things but from some reason it just doesn’t record the way that it plays sometimes. But sometimes it grabs the momentum of the pedal perfectly after hearing the recording back