Please assume the role of a unity developer specialising in unity 2020.2.6f1 and visual studio 2017. I seperated a script earlier now I want to merge them together again. Script 1 is the main script that I want all the logic and functionality to replace the relevant parts of the script related to ramp detection.
Script 1:
using UnityEngine;

public class GrindDetection : MonoBehaviour
{
    [Header("Rail Settings")]
    [SerializeField] private float railDetectionRadius = 2f;

    private Rail rail;
    private HoverBoardControl hoverBoardControl;

    [Header("Trick Colliders")]
    [SerializeField] private Transform frontTruckTransform;
    [SerializeField] private Transform backTruckTransform;
    [SerializeField] private Transform boardMiddleTransform;
    [SerializeField] private Transform noseTransform;
    [SerializeField] private Transform tailTransform;

    private GrindTrigger frontTruck => frontTruckTransform.GetComponent<GrindTrigger>();
    private GrindTrigger backTruck => backTruckTransform.GetComponent<GrindTrigger>();
    private GrindTrigger boardMiddle => boardMiddleTransform.GetComponent<GrindTrigger>();
    private GrindTrigger nose => noseTransform.GetComponent<GrindTrigger>();
    private GrindTrigger tail => tailTransform.GetComponent<GrindTrigger>();

    [Header("Settings")]
    [SerializeField] private float grindControlSensitivity = 1f;
    [SerializeField] private float grindSpeed = 50f;

    [Header("Input Settings")]
    [SerializeField] private KeyCode grindKey = KeyCode.G;

    [Header("Ramp Detection Settings")]
    [SerializeField] private float minRampAngle = 80f;
    [SerializeField] private float maxRampAngle = 100f;

    private Collider[] railColliders;
    private Collider railCollider;

    private Rigidbody rb;

    private float sidewaysAngle;
    private float frontsideBacksideAngle;
    private bool railTravelBackwards;
    private bool isGrindingOrSliding;

    private void Awake()
    {
        hoverBoardControl = GetComponentInParent<HoverBoardControl>();
        rb = GetComponentInParent<Rigidbody>();
    }

    private void FixedUpdate()
    {
        GetRail();
        GrindSlideCheck();
        GetRotationRelativeToCamera();
        RampDetection();
    }

    private void GetRail()
    {
        railColliders = Physics.OverlapSphere(rb.position, railDetectionRadius, LayerMask.GetMask("Rail"));
        if (railColliders.Length != 0)
        {
            railCollider = railColliders[0];
            rail = railCollider.GetComponent<Rail>();
        }
        if (!isGrindingOrSliding && hoverBoardControl.IsGrounded)
        {
            railColliders = null;
        }
    }

    private void GetRotationRelativeToCamera()
    {
        Vector3 forward = hoverBoardControl.transform.forward;
        Vector3 forward2 = rb.transform.forward;
        sidewaysAngle = Vector3.Dot(forward, forward2);
        frontsideBacksideAngle = Vector3.Dot(forward, rb.transform.right);
    }

    private void GrindSlideCheck()
    {
        if (railCollider == null)
        {
            return;
        }
        float num = Vector3.Dot(hoverBoardControl.transform.forward, rail.transform.forward);
        if (num > 0f)
        {
            railTravelBackwards = false;
        }
        else if (num < 0f)
        {
            railTravelBackwards = true;
        }
        bool boardSlideCheck = boardMiddle.Trigger;
        bool frontTruckGrindCheck = frontTruck.Trigger;
        bool backTruckGrindCheck = backTruck.Trigger;
        bool noseSlideCheck = nose.Trigger;
        bool tailSlideCheck = tail.Trigger;

        if (frontTruckGrindCheck || backTruckGrindCheck)
        {
            if (sidewaysAngle > 0.3f || sidewaysAngle < -0.3f)
            {
                rb.isKinematic = true;
                hoverBoardControl.IsGrounded = false;
                hoverBoardControl.GrindAudioVolumeLerp(1f, 20f);
                float num2 = hoverBoardControl.BoardTilt.x * grindControlSensitivity;
                float num3 = hoverBoardControl.BoardTilt.y * grindControlSensitivity;
                float num4 = 50f;
                if (railTravelBackwards)
                {
                    num3 = -num3;
                }

                if (backTruckGrindCheck && frontTruckGrindCheck)
                {
                    rb.transform.RotateAround(backTruckTransform.position, new Vector3(0f, 1f, 0f), num2 * Time.deltaTime);
                    rb.transform.RotateAround(backTruckTransform.position, rail.transform.right, num3 * Time.deltaTime);
                }
                if (backTruckGrindCheck)
                {
                    RotateWithSteering(backTruckTransform, num2, num3, num4);
                }
                else if (frontTruckGrindCheck)
                {
                    RotateWithSteering(frontTruckTransform, num2, num3, num4);
                }
            }
        }
        else if (tailSlideCheck || noseSlideCheck)
        {
            rb.isKinematic = true;
            hoverBoardControl.IsGrounded = false;
            hoverBoardControl.GrindAudioVolumeLerp(0f, 20f);
            float num5 = 50f;
            float num6 = 5f;
            rb.transform.localRotation = Quaternion.Lerp(rb.transform.localRotation, Quaternion.Euler(new Vector3(rb.transform.localEulerAngles.x, rb.transform.localEulerAngles.y, 0f)), num6 * Time.deltaTime);
            float num7 = hoverBoardControl.BoardTilt.y * grindControlSensitivity;

            if (railTravelBackwards)
            {
                num7 = -num7;
            }

            if (noseSlideCheck)
            {
                RotateWithSteering(noseTransform, 0f, num7, num5);
            }
            else if (tailSlideCheck)
            {
                RotateWithSteering(tailTransform, 0f, num7, num5);
            }
        }
        else if (boardSlideCheck)
        {
            rb.isKinematic = true;
            hoverBoardControl.IsGrounded = false;
            hoverBoardControl.GrindAudioVolumeLerp(1f, 20f);
            float num8 = -rail.transform.localEulerAngles.x;

            if (frontsideBacksideAngle < -0.3)
            {
                num8 = -num8;
            }

            if (railTravelBackwards)
            {
                num8 = -num8;
            }

            rb.transform.localRotation = Quaternion.Lerp(rb.transform.localRotation, Quaternion.Euler(new Vector3(num8, rb.transform.localEulerAngles.y, 0f)), 5f * Time.deltaTime);
            float num9 = 50f;

            if (railTravelBackwards)
            {
                num9 = -num9;
            }

            rb.transform.Rotate(Vector3.up * grindSpeed * Time.deltaTime, Space.World);
            Vector3 position = rb.position;
            float num10 = 0.1f;
            position = Vector3.Lerp(position, railCollider.ClosestPoint(position), num10);
            rb.position = position;
            hoverBoardControl.transform.localRotation = rb.transform.localRotation;
            hoverBoardControl.transform.rotation = rb.transform.rotation;

            if (boardMiddle.Trigger)
            {
                StartGrind(); // Add this line to start the grind
            }
        }
        else
        {
            rb.isKinematic = true;
            hoverBoardControl.IsGrounded = false;
            hoverBoardControl.GrindAudioVolumeLerp(0f, 20f);
            Vector3 position2 = rb.position;
            position2 = Vector3.Lerp(position2, railCollider.ClosestPoint(position2), 0.1f * Time.deltaTime);
            rb.position = position2;
            rb.transform.rotation = Quaternion.Lerp(rb.transform.rotation, Quaternion.Euler(0f, rb.transform.eulerAngles.y, 0f), 20f * Time.deltaTime);
            hoverBoardControl.transform.localRotation = rb.transform.localRotation;
            hoverBoardControl.transform.rotation = rb.transform.rotation;

            if (tail.Trigger || nose.Trigger)
            {
                // Adjust rotations and movements as needed
            }
        }
    }

    private void RotateWithSteering(Transform truckTransform, float num2, float num3, float num4)
    {
        rb.transform.RotateAround(truckTransform.position, new Vector3(0f, 1f, 0f), num2 * Time.deltaTime);
        rb.transform.RotateAround(truckTransform.position, rail.transform.right, num3 * Time.deltaTime);

        if (hoverBoardControl.IsSteeringLeft)
        {
            rb.transform.RotateAround(truckTransform.position, new Vector3(0f, 1f, 0f), (0f - num4) * Time.deltaTime);
        }
        else if (hoverBoardControl.IsSteeringRight)
        {
            rb.transform.RotateAround(truckTransform.position, new Vector3(0f, 1f, 0f), num4 * Time.deltaTime);
        }
    }

    private void RampDetection()
    {
        if (railCollider == null)
        {
            return;
        }
        RaycastHit hit;
        if (Physics.Raycast(rail.transform.position, rail.transform.TransformDirection(Vector3.forward), out hit, railDetectionRadius))
        {
            float num = Vector3.Dot(hoverBoardControl.transform.forward, rail.transform.forward);
            if (num > 0f && hit.collider.gameObject.layer == LayerMask.NameToLayer("Ramp"))
            {
                Vector3 vector = Vector3.ProjectOnPlane(hit.normal, Vector3.up);
                float num2 = Vector3.Angle(vector, hoverBoardControl.transform.forward);

                if (num2 > minRampAngle && num2 < maxRampAngle)
                {
                    hoverBoardControl.IsGrounded = true;
                    rb.isKinematic = false;

                    // Apply rotation to the hoverboard based on the ramp angle
                    float angleDifference = Mathf.DeltaAngle(hoverBoardControl.transform.rotation.eulerAngles.x, num2);
                    Quaternion newRotation = Quaternion.Euler(num2, rb.transform.eulerAngles.y, 0f);
                    rb.transform.rotation = Quaternion.Lerp(rb.transform.rotation, newRotation, 5f * Time.deltaTime);
                }
            }
        }
    }

    public bool IsGrinding()
    {
        return isGrindingOrSliding;
    }

    public KeyCode GrindKey
    {
        get { return grindKey; }
    }

    // Add the StartGrind method
    public void StartGrind()
    {
        isGrindingOrSliding = true;
    }
}

Script 2: 
using System.Collections;
using UnityEngine;

public class RampDetection : MonoBehaviour
{
    [Header("Ramp Detection Settings")]
    [SerializeField] private Transform[] rampDetectionPoints;
    [SerializeField] private float detectionRadius = 2f;
    [SerializeField] private float minRampAngle = 80f;
    [SerializeField] private float maxRampAngle = 100f;
    [SerializeField] private float rotationSpeed = 5f; // Speed of rotation adjustment

    private HoverBoardControl hoverBoardControl;
    private Rigidbody rb;

    private void Awake()
    {
        hoverBoardControl = GetComponentInParent<HoverBoardControl>();
        rb = GetComponentInParent<Rigidbody>();

        if (rampDetectionPoints == null || rampDetectionPoints.Length == 0)
        {
            Debug.LogError("RampDetectionPoints have not been assigned in the Inspector", this);
        }
    }

    private void FixedUpdate()
    {
        foreach (var detectionPoint in rampDetectionPoints)
        {
            DetectRamp(detectionPoint);
        }
    }

    private void DetectRamp(Transform detectionPoint)
    {
        if (detectionPoint != null)
        {
            RaycastHit hit;
            if (Physics.Raycast(detectionPoint.position, -Vector3.up, out hit, detectionRadius))
            {
                if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Ramp"))
                {
                    Vector3 rampNormalProjection = Vector3.ProjectOnPlane(hit.normal, Vector3.up);
                    float rampAngle = Vector3.Angle(detectionPoint.forward, rampNormalProjection);

                    if (rampAngle >= minRampAngle && rampAngle <= maxRampAngle)
                    {
                        AdjustHoverboard(hit, detectionPoint.name);
                    }
                }
            }
        }
    }

    private void AdjustHoverboard(RaycastHit hit, string hitPart)
    {
        Debug.Log(hitPart + " detected a ramp collision");

        // Calculate the target alignment of the hoverboard based on the ramp normal
        Vector3 forwardDirection = Vector3.Cross(hit.normal, Vector3.Cross(Vector3.up, hit.normal)).normalized;
        Quaternion targetRotation = Quaternion.LookRotation(forwardDirection, hit.normal);

        // Smoothly lerp the hoverboard’s rotation to the target rotation
        StartCoroutine(SmoothRotateOverTime(rb.transform, targetRotation, rotationSpeed));

        // Set IsGrounded to true to simulate physics behavior while on the ramp
        hoverBoardControl.IsGrounded = true;

        // Adjust hover height based on ramp collision
        float hoverHeight = Mathf.Max(hit.distance, hoverBoardControl.hoverHeight);
        hoverBoardControl.SetHoverHeight(hoverHeight);
    }

    private IEnumerator SmoothRotateOverTime(Transform transform, Quaternion targetRotation, float rotateSpeed)
    {
        while (Quaternion.Angle(transform.rotation, targetRotation) > 0.1f)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotateSpeed * Time.deltaTime);
            yield return new WaitForSeconds(Time.fixedDeltaTime); // Wait for next physics update
        }
    }
}