I have created a script (see below) that works ok but only in case if all parameters are required inputs. Quite simple, Roads(line) and Trackts(polygon) feature classes , first buffer Roads and then clip to Tracts. There are more feature classes in Zion.gdb but I am just doing a test script to figure out optional input parameters.
What I need is that user should be able to select the layer they want to buffer, the layer they want to clip, the output location/name of the clip, and the buffer distance. All of it has to be optional. The problem is when I set for example Tracts and Tracts_Clip feature classes to optional in Script Parameters and do not apply them in script execution because I want only Roads buffer, the script does not work.
import arcpy
from arcpy import env
    # set environment settings
    env.workspace = "C:/data/Zion.gdb"
    env.overwriteOutput = True
    # Script arguments
    Roads = arcpy.GetParameterAsText(0)
    if Roads == '#' or not Roads:  
        Roads = arcpy.GetParameterAsText(0) # provide a default value if unspecified
    Tracts = arcpy.GetParameterAsText(1)
    if Tracts == '#' or not Tracts:
        Tracts = arcpy.GetParameterAsText(1) # provide a default value if unspecified
    Tracts_Clip = arcpy.GetParameterAsText(2)
    if Tracts_Clip == '#' or not Tracts_Clip:
        Tracts_Clip = arcpy.GetParameterAsText(2) # provide a default value if unspecified
    Buffer_Distance = arcpy.GetParameterAsText(3)
    if Buffer_Distance == '#' or not Buffer_Distance:
        Buffer_Distance = arcpy.GetParameterAsText(3) # provide a default value if unspecified
    # Local variables:
    Tracts_Clip = arcpy.GetParameterAsText(2)
    Buffer_Distance = arcpy.GetParameterAsText(3)
    Roads_Buffer = "Roads_Buffer"
    # Process: Buffer
    arcpy.Buffer_analysis(Roads, Roads_Buffer, Buffer_Distance,"FULL", "ROUND", "ALL", "", "")
    # Process: Clip (1)
    arcpy.Clip_analysis(Tracts, Roads_Buffer, Tracts_Clip, "")
    
