Getting a different transform position value

Hey master coders of the universe! This thing has been driving me crazy and I’m in need of some assistance.

I need to change the transform.position value of a Canvas UI Image in order for a bar in the game to work. It’s basically an RPM light bar for a driving game that i’m working on. Anyways, here’s the code of getting the RPM number.

using UnityEngine;

public class DigitalRPM : MonoBehaviour
    public float RPMValue;
    public GameObject RPMBar;

    void Update()
        RPMValue = (RCC_SceneManager.Instance.activePlayerVehicle.engineRPM);
        RPMBar.transform.position = new Vector3(RPMValue, transform.position.y, transform.position.z);

Attached the above script to an RPM Manager object. Debug.Log shows the accurate RPM value however when I run the game and the engine is idle at 885 i get 317 on the x position of the UI object and for some reason the y position also changes from 0 to -322. Attached an image for visual explanation. Hopefully didn’t confuse any of you even further.

Finally fixed by using .GetComponent<RectTransform>().anchoredPosition. So the last line looks like RPMFade.GetComponent<RectTransform>().anchoredPosition = new Vector3(RPMValue, transform.position.y, transform.position.z); and everything works now!