Help : Cannot Move Gameobject using transform in script

I am trying to move a gameobject to right when the right arrow key is pressed. I don’t want to use physics, so i try to add the transform position but it doesn’t work. I have tried using translate to but it didn’t work. I can move the object in the scene view and the transform’s value is changed, but in the play mode i can’t move it. Need some explanation from the expert ^^.
Here is the code i am using to move the object

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour {

    public float speed = 0.1f;
    public GameObject player;

	// Use this for initialization
	void Start () {
    float x = 0;
	// Update is called once per frame
	void Update ()
        if (Input.GetKey(KeyCode.RightArrow))
            x += speed;
            Vector3 newposition = new Vector3(x, 0, 0);
            player.transform.position = newposition;


I have figured it out, i was using animation to the child gameobject but i tried to move the parent gameobject. I add an animator to the gameobject and I tick the apply root motion and it works. Thank you for the replies ^^

Have you checked that you’ve dragged your player object into the ‘player’ variable in the inspector?

Thank you for saving me!