Issues with copying Y axisrotation of another object

Sorry about my lack of knowledge in advance, I’m not great at using Unity.
I’m trying to make a script that copies the X, Y and Z position and the Y rotation of another object. Here’s my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FollowSphere : MonoBehaviour
    public Transform playerTransform
    public GameObject self; //this is the object the script is attached to
    public Quaternion newRotation;
    void Update()
        self.transform.position = playerTransform.position //this actually works
        newRotation = new Quaternion(0f, playerTransform.rotation.y, 0f, 0f) // I have no idea what I am doing
        self.transform.rotation.Set(newRotation); //I really have no idea what I am doing

Somebody please help me :frowning:
I’d appreciate if you could redo the code so it’s more efficient, but if you’re going to do so please explain what each different line does so I know for the future. Once again, sorry about my lack of knowledge and thank you for your help!

am I allowed to bump?

Here, try this

 * Script Summary:
 * Copies the Transform (Position & Rotation) of one GameObject(source) to Other(target)
using UnityEngine;

/// <summary>
/// Identifies the type of cordinates to be replicated
/// </summary>
public enum CordinateType {
public class ReplicateTranslationAndRotaion : MonoBehaviour {

    [Tooltip("Drag here the GameObject whose transform is to be COPIED FROM.")]
    public GameObject sourceGameObject;
    [Tooltip("Drag here the GameObject whose transform is to be CHANGED TO.")]
    public GameObject targetGameObject;

    /// <summary>
    /// Equates Position and Rotation of two GameObjects (both Local and Global)
    /// </summary>
    /// <param name="sourcePosition">Transform of the GameObject to COPY VALUES FROM</param>
    /// <param name="targetPosition">Transform of the GameObject to COPY VALUES TO</param>
    /// <param name="cordinateType">Defines the Cordinate</param>
    public void EquateTransform (Transform sourcePosition, Transform targetPosition, CordinateType cordinateType) {
        if (cordinateType == CordinateType.Local)
            targetPosition.position = sourcePosition.position;
            targetPosition.rotation = sourcePosition.rotation;
        if (cordinateType == CordinateType.Global)
            targetPosition.localPosition = sourcePosition.localPosition;
            targetPosition.localRotation = sourcePosition.localRotation;

Hope this Helps!

Did u try using eularangles…