How can I get my spaceships to tilt when i turn left or right using c#,How do you tilt a spaceship when turning left or right using c#?

I am currently making a top down space shooter and need to smooth out some of the movement of the spaceships, i want the space ship the tilt by some degrees to the left when it turns left and tilt to the right when turning right. i do not know a lot about coding so it would mean a lot to me if you are able to help me with this. thanks in advance.
,I am currently making a top down space game in unity and I am trying to smooth out the movement of the spaceships so i want it to tilt when you turn left or right, it would mean a lot too me if you could help me with this, thank you.

Tilt is a generalized term for gameObject’s rotation. Rotation of an object is expressed by a Quaternion. You need to calculate the new rotation and assign it to the object’s transform in every Update. Let’s say that the tilt is determined by the ship’s vertical speed. then you might try something like

float m_maxTilt = 30f;       // hard limit for tilt angle
float m_tiltFactor = 5f; // or how much does tilt change with velocity
var tilt = Mathf.Clamp(m_velocity.y * m_tiltFactor, -maxTilt , maxTilt ); // calculate the tilt angle
gameObject.transform.rotation = Quaternion.Euler(tilt,0,0); // calculate and assign the quaternion, tilting over the X axis

thanks a lot, i tried to implement it in with my movement but it seems that it does not work, this is the script i am using, it would be nice if you could tell me the flaws i have made.

 `using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class playermovement : MonoBehaviour
    {
        [SerializeField] float movementspeed = 20f;
        [SerializeField] float turnspeed = 60f;
        [SerializeField] float m_maxTilt = 30f;// hard limit for tilt angle
        [SerializeField] float m_tiltFactor = 5f;// or how much does tilt change with velocity
        void Update()
    
        {
            Turn();
            Thrust();
            tilt();
        }
    
        void Turn()
        {
            float yaw = turnspeed * Time.deltaTime * Input.GetAxis("Horizontal");
            transform.Rotate(0, yaw, 0);
    
        }
    
    
        void Thrust()
        {
            if (Input.GetAxis("Vertical") > 0)
                transform.position += transform.forward * movementspeed * Time.deltaTime * Input.GetAxis("Vertical");
        }
    
    
    
        void tilt()
        {
            var tilt = Mathf.Clamp(m_velocity.y * m_tiltFactor, -maxTilt, maxTilt); // calculate the tilt angle
            gameObject.transform.rotation = Quaternion.Euler(tilt, 0, 0); // calculate and assign the quaternion, tilting over the X axis
        }
    }`