How to screen record using AppleScript on Catalina?
Without seeing your AppleScript code, all I can say is that for me, as an example, on macOS High Sierra doing a screen recording requires different coding then on macOS Catalina, as the latter no longer actually uses QuickTime Player to do the actual screen recording.

This may also hold true for macOS Mojave, however, the following example AppleScript code was only tested under macOS Catalina:

--  # Setup to do a screen recording.

tell application "QuickTime Player" to new screen recording

--  # Start the screen recording.

tell application "System Events" to tell process "Screen Shot"
    repeat until exists button "Record" of its front window
        delay 0.1
    end repeat
    click button "Record" of its front window
end tell

--  # Set the time in seconds you want the recording to be.

delay 2

--  # Stop the recording.

tell application "System Events" to ¬
    click menu bar item 1 ¬
        of menu bar 1 ¬
        of application process "screencaptureui"


At this point, by default, when the screen recording is stopped, it is saved to the Desktop as e.g. Screen Recording 2019-11-01 at 3.38.00 PM.mov on my system and opened in QuickTime Player.

Additional coding can be included to do whatever else one would like to do with the screen recording (within the limits of the target app and AppleScript).

That all said, since macOS Catalina is actually using a different application to do the actual screen recording and not QuickTime Player, one could skip the use of QuickTime Player and create the screen recording using the following example AppleScript code, which uses the system default keyboard shortcut ⇧⌘5:

--  # Setup to do a screen recording.

tell application "System Events" to keystroke "%" using {shift down, command down}

--  # Start the screen recording.

tell application "System Events" to tell process "Screen Shot"
    repeat until exists its front window
        delay 0.1
    end repeat
    if not (exists button "Record" of its front window) then
        click checkbox "Record Entire Screen" of its front window
    end if
    click button "Record" of its front window
end tell

--  # Set the time in seconds you want the recording to be.

delay 2

--  # Stop the recording.

tell application "System Events" to ¬
    click menu bar item 1 ¬
        of menu bar 1 ¬
        of application process "screencaptureui"



Note the use of % instead of 5 in keystroke "%" as the shift key is pressed and I'm on a US English keyboard.
The usual caveats, regarding System Preferences > Security &amp; Privacy > Privacy, apply.




Note: The example AppleScript code is just that and does not contain any additionally error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.