Movement Help (708333)

Hey, So I am really new to Unity and scripting. I found a movement script that somebody else made and I am trying to use it for my own but it is not working. I am not getting any errors but when I try to test it the character does not move. Can anyone help???

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

public class Playermovement : MonoBehaviour
{

private float speed;

private Vector2 direction;
void Update()
{
//Executes the GetInput function
GetInput();

//Executes the Move function
Move();
}

public void Move()
{

transform.Translate(direction * speed * Time.deltaTime);
}

///


/// Listen’s to the players input
///

private void GetInput()
{
direction = Vector2.zero;

if (Input.GetKey(KeyCode.W))
{
direction += Vector2.up;
}
if (Input.GetKey(KeyCode.A))
{
direction += Vector2.left;
}
if (Input.GetKey(KeyCode.S))
{
direction += Vector2.down;
}
if (Input.GetKey(KeyCode.D))
{
direction += Vector2.right;
}
}
}

“speed” has not been assigned. The console should be showing this as a warning, and playing the game should be giving you an error message every frame, since Update is calling Move, which is trying to multiply it when it is a non-existent value.

If the console is not showing anything, you may have disabled logs/warnings/errors. Make sure these buttons are toggled on (left = logs, middle = warnings, right = errors):

Now regarding the script, it looks like the “speed” variable was meant to be set to public instead of private so that it could be assigned from the inspector.
Simply make this change and assign it a value from the inspector.

That worked, thanks for the help.