Object changes place in game

Hi,

When I place an object in the scene and I press play to play the game, the object changed place. I dont’t know why that is. I also added a code that they can move up and down. Sometimes they change place and sometimes not… .

Here are some screenshots:

and here is the code for moving them:

 float originalY;
 public float floatStrength = 1;

 void Start()
  {
    this.originalY = this.transform.position.y;
  }


  void Update()
  {
    transform.position = new Vector3(transform.position.x, 
       originalY + ((float)Math.Sin(Time.time) * floatStrength),
       transform.position.z);
  }

can someone help me with this?
Thank you in advance
Cynni

@Cobalt60 Thnx :slight_smile:
This is not the player control. This is just the code that makes the gems move up and down.