Hmm, I see that you define a “gameobject” variable and never initiate it, so I imagine you are controlling a different game object through this script by dragging it in the inspector. However, then you use transform.position, which will affect the transform of the game object the script is attached to instead of your “gameobject” variable. Use “gameobject.transform.position” instead, or, even better, don’t use that “gameobject” variable at all and instead apply the script directly to the object you wish to affect.