I went to that particular download, and this is clearly advertised on it...
JointedRail content is currently supported ONLY in Trainz: A New Era SP4 build 105766 thru current Trainz Railroad Simulator 2019 versions.
So the scripts are clearly not compatible to the version you're attempting to run it with. The rendering on the GP40-2 also highlights the incompatibility.