Rotate a direction by the Y of an object?

I want to rotate a direction by the Y of my player

I cant use transform.forward because the player isn’t always flat
and I cant use eaulerangles.y because they go all funny at certain x and z angles

I am not sure to understand but check this:

transform.rotation = Quaternion.AngleAxis(30, Vector3.up);

Not what im looking for. I need a direction from the player, level with the ground in a direction they chose.
Right now its it doesn’t do the right thing when on slopes.

Vector3 tiltInput = new Vector3(Input.GetAxis(“Horizontal”), 0 , Input.GetAxis(“Vertical”));
Vector3 fromProj = transform.forward - (Vector3.Dot(transform.forward, Vector3.up) * Vector3.up);
Vector3 tilt = Quaternion.LookRotation(fromProj) * tiltInput;

Vector3 temp = Vector3.Cross(hit.normal, tilt);
Vector3 rayDirection = Vector3.Cross(temp, hit.normal);

Debug.DrawRay(transform.position, rayDirection * 10, Color.magenta);

Got this from another guy, works perfectly

Vector3 tiltInput = new Vector3(Input.GetAxis(“Horizontal”), 0 , Input.GetAxis(“Vertical”));
Vector3 projForward = transform.forward - (Vector3.Dot(transform.forward, hit.normal) * hit.normal);
Vector3 rayDirection = Quaternion.LookRotation(projForward, hit.normal) * tiltInput;
rayDirection.Normalize();

Debug.DrawRay(transform.position, rayDirection * 10, Color.magenta);