2d Character movement script (unity 4,3)

I found this script on google, because there isn’t many tutorials, im learning from the script itself. The script is from 2010 and represents 2d movement. But it does not work with the new update 4,3 with the 2d features. The script can’t needs a ridgidbody. But now there is a ridgidbody 2D feature, and that is the ridgidbody i use.
It says in the console log, that no ridgidbody is attached to my 2d player but the script is trying to acces the ridgidbody, and i use the 2d ridgidbody.
Ive tried modifying it and saying ridgidbody2d instead and some other stuff but it does not work. Can you help?

// The horizontal speed of the keyboard controls. A higher value will
// cause the object to move more rapidly.
var keyboardSpeed = 20.0;

// FixedUpdate is a built-in unity function that is called every fixed framerate frame.
// According to the docs, FixedUpdate should be used instead of Update when dealing with a
// Rigidbody.
function FixedUpdate () {
// This is where we move the object.

// Get input from the keyboard, with automatic smoothing (GetAxis instead of GetAxisRaw).
// We always want the movement to be framerate independent, so we multiply by Time.deltaTime.
var keyboardX = Input.GetAxis("Horizontal") * keyboardSpeed * Time.deltaTime;
var keyboardY = Input.GetAxis("Vertical") * keyboardSpeed * Time.deltaTime;

// Calculate the new position based on the above input.
// If you want to limit the movement, you can use Mathf.Clamp
// to limit the allowed range of newPos.x or newPos.y.
var newPos = rigidbody.position + Vector3(keyboardX, keyboardY, 0.0);

// Move the object.
rigidbody.MovePosition(newPos);

}

this code below works for me for moving 2d objects. i am new to coding but found a youtube video on 2d platforming. i managed to edit this code by duping it and changing Horizontal axisName to Vertical and right transform to ‘up’ hope this helps. but i am a noob so who knows

using UnityEngine;
using System.Collections;

public class moveLeftRight : MonoBehaviour {

	public float speed =1.0f;
	public string axisName = "Horizontal";
	public Animator anim;

	// Use this for initialization
	void Start () {
		anim = gameObject.GetComponent<Animator> ();
	}
	
	// Update is called once per frame
	void FixedUpdate () {
		anim.SetFloat("Speed", Mathf.Abs(Input.GetAxis(axisName)));
		if (Input.GetAxis (axisName) < 0)
		{
				Vector3 newScale = transform.localScale;
				newScale.y = 1.0f;
				newScale.x = 1.0f;
				transform.localScale = newScale;
		} 
		else if (Input.GetAxis (axisName) > 0)
		{
				Vector3 newScale =transform.localScale;
				newScale.x = 1.0f;
				transform.localScale = newScale;		
		}

		transform.position += transform.right *Input.GetAxis(axisName)* speed * Time.deltaTime;

	}
}

I’ve made a project recently and uploaded it on my blog which demostrates efficient and convinient way of 2D character movement and jumping using rigidbody. you can view my blog by clicking here

You can download the latest version of mY 2D character game From the below link. –
Download

There is a option in the inspector under animator, where you need to check the option ‘Apply root motion’. This might solve your problem. If not let me know and ill look into it, but that error flags if you don’t check it with the new unity 2d engine.