Why isn't transform.position working?

transform.position isn’t working.
Here’s the code
void Update()
{

if (Input.GetKeyDown(KeyCode.R))
{

transform.position = new Vector3(0, 1, 0);
}
}

What i am intending for the code to do is to whenever i press r it goes to the position 0, 1, 0

in the text it looks like the if then sentence isn’t in the void update function but i assure you in unity it is

What “isn’t working”? Does it print an error, not compile, or just not seem to do anything?

Add Debug.Log() calls inside your if condition to verify that that line of code is executing. If it is not, add a Debug.Log call in the Update function to verify that your script is running.

The script is running. In fact the input.getkeydown script is running because i put the debug log in that code. Its the transform.pos that isn’t working which means it isn’t doing anything

Nevermind i figured it out. The gameObject i was trying to apply it to already has a bajillion move functions applying to it and i think they cancelled the transform.pos code