# Absolute beginner here! My cube won't move :(

I’m getting no errors from my script, but when I play in game mode nothing happens to my poor cube. ``````using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour
{
public float movespeed = 5f; //Change this to change how fast he moves
public float turnspeed = 5f; //Change this to change how quick he turns

void update () //Class - Subroutine. Void means no variables coming out. () signifies class.
{
if(Input.GetKeyDown(KeyCode.UpArrow)) //If the button is pressed then it will execute the next line.
transform.Translate(Vector3.forward * movespeed * Time.deltaTime); //It moves the character forward by the speed times delta time.
}

}
``````

U need to declare only a variable after the script’s class and then multiply it to add the movement along the axis u want:
using UnityEngine;
using System.Collections;

``````public class lerpSphere : MonoBehaviour {

public float m_speed = 2.0f;

// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {

if (Input.GetKey(KeyCode.A))
{
transform.Translate (m_speed*Time.deltaTime,0,0);
}

if (Input.GetKey(KeyCode.D))
{

transform.Translate (-m_speed*Time.deltaTime,0,0);
}
}
}
``````

Cheers

I assume by forward you mean along the z-axis. Change your code to be:

``````transform.Translate(0, 0, movespeed * Time.deltaTime);
``````

That’s it.
{"ft_lang_label":"__label__en","ft_lang_prob":0.72417295,"math_prob":0.79267627,"size":658,"snap":"2023-40-2023-50","text_gpt3_token_len":144,"char_repetition_ratio":0.099388376,"word_repetition_ratio":0.060606062,"special_character_ratio":0.23404256,"punctuation_ratio":0.15833333,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9615375,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-27T02:57:51Z\",\"WARC-Record-ID\":\"<urn:uuid:0227596d-ad75-402b-b742-1609c54cbf60>\",\"Content-Length\":\"23211\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:11ec29b5-a33b-4af2-8d28-9c7b1bbb775c>\",\"WARC-Concurrent-To\":\"<urn:uuid:eb1aec19-c6f4-4a34-a69c-303cb12c9d5b>\",\"WARC-IP-Address\":\"184.104.178.75\",\"WARC-Target-URI\":\"https://discussions.unity.com/t/absolute-beginner-here-my-cube-wont-move/74709\",\"WARC-Payload-Digest\":\"sha1:RAWBRILJXFE6JAQ3XQ2QPW6WOABZY5SG\",\"WARC-Block-Digest\":\"sha1:NFIBFLG3DGBN7GD7VE77DJBSOFTXT6U4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510238.65_warc_CC-MAIN-20230927003313-20230927033313-00538.warc.gz\"}"}