n object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)'

I am a new programmer and I am trying to do this character controller P.S. I am following Youtube video. But I ran into this problem of ‘object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)’. Can someone explain to me what the problem is? I’d rather understand the problem then try to solve it myself :slight_smile:
thank you.
Here is my code its rather simple.

using UnityEngine;
using System.Collections;

public class PlayerMovment : MonoBehaviour {
public float movementSpeed;

private Vector3 input;

void Start () {

}

void Update () {
	input = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
	Rigidbody.AddForce(input * movementSpeed);
}

}

Rigidbody is UnityEngine component and not the Object Component. You need to reference it like

public Rigidbody rigidBody;

then use it

rigidBody.AddForce(input * movementSpeed);

So the full code would be something like this :
public class tryl : MonoBehaviour {

	public float movementSpeed;
	private Vector3 input;
	public Rigidbody rigidBody;
	
	void Update () {
		input = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
		rigidBody.AddForce(input * movementSpeed);
		//or
		GetComponent<Rigidbody>().AddForce(input * movementSpeed);
	}
}