Need help with scripts

please get rid of error in this script (Assets/Scripts/Driving.js(291,44): BCE0005: Unknown identifier: ‘Data’.)

function OnGUI () {
var pointerPosition : float = 40.0;
//var OffsetX : float =100;
//var OffsetY : float =100;
OffsetX = Screen.width -150;
OffsetY = Screen.height -150;

//GUILayout.BeginArea(Rect(OffsetX,OffsetY,200,200));
GUI.Label(Rect (10, 200, 80, 200), Data.g_userName);

GUI.Box(Rect(0.0 + OffsetX,0.0 + OffsetY,140.0,140.0),guiSpeedDisplay);

if (currentSpeed>0) {
pointerPosition = currentSpeed + 40;
}

GUIUtility.RotateAroundPivot(pointerPosition,Vector2(70 + OffsetX,70+ OffsetY));
GUI.DrawTexture(Rect(0.0 + OffsetX,0.0+ OffsetY,140.0,140.0),guiSpeedPointer, ScaleMode.StretchToFill,true,0);
//GUILayout.EndArea();

and this script (Assets/Scripts/Menu-chamging car.js(22,9): BCE0005: Unknown identifier: ‘PlayPrefs’.)

function OnGUI(){
/*
GUI.Label(Rect(10,50,300,100),“Only Test version.”)
if (GUI.Button(rect(10,50,300,100),“Start”)){
Application.LoadLevel(1);
}
*/
GUILayout.BeginArea(Rect((Screen.width/2)-150,(Screen.height/2)-250,300,500));
//GUILayout.Label(“Dies ist ein Test.”);

if (PlayerPrefs.HasKey(“Player”)){
playerName = PlayerPrefs.GetString(“Player”);
GUILayout.Label(“Hello” + playerName);
}

playerName = GUILayout.TextField(playerName);
PlayPrefs.Settring(“Player”,playerName);

//playerName = PlayerPrefs.GetString(“Player”);

if (GUILayout.Button(“Start”)){
Application.LoadLevel(2);
}
GUILayout.EndArea();

}

thank you in advance

You didn’t iniatilize the variables “Data” and “PlayPrefs”.
Most likely you copypasted the code but missed part of it?

For PlayPrefs, maybe you just need to rename it in “PlayerPrefs”.

when i rename PlayPrefs show the error Assets/Scripts/Menu-chamging car.js(22,21): BCE0019: ‘Settring’ is not a member of ‘UnityEngine.PlayerPrefs’.

well this is because you misspelled the variable.
Seriously, though, you might want to learn a few things about programming BEFORE trying to make a game.
No offense meant, but these things are quite basic and you cannot simply copy and paste stuff and hope it works.

Please use code tags when posting code

As Pasko elluded. You did not initialize the Data varibale, and you have a few typo’s in your code. Double clicking on the error in the Unity Console will take you to the line that has the error, from there, you can figure out if it is a typo or other type of error.

I will point this out. You MUST develop good error checking skills to work in any type of programming. It may look Greek (or Arabian if your Greek) but each line and each letter, number and symbol mean something in Unity and you cannot take for granted that anything is right. Use the Console as a tool to help you fix code.

As far as your code, I added in some stuff that would hopefully fix what you had there. I don’t know what all your variables work, but I strived not to get errors in the console.

[COLOR="red"]class data{
	var g_userName : String="";
}

var Data=new data();
var guiSpeedDisplay : Texture;
var currentSpeed : float=0;
var guiSpeedPointer : Texture;[/COLOR]

function OnGUI () {
	var pointerPosition : float = 40.0;
	//var OffsetX : float =100;
	//var OffsetY : float =100;
	OffsetX = Screen.width -150;
	OffsetY = Screen.height -150;


	//GUILayout.BeginArea(Rect(OffsetX,OffsetY,200,200)) ;
	GUI.Label(Rect (10, 200, 80, 200), Data.g_userName);

	GUI.Box(Rect(0.0 + OffsetX,0.0 + OffsetY,140.0,140.0),guiSpeedDisplay);

	if (currentSpeed>0) {
		pointerPosition = currentSpeed + 40;
	}

	GUIUtility.RotateAroundPivot(pointerPosition,Vector2(70 + OffsetX,70+ OffsetY));
	GUI.DrawTexture(Rect(0.0 + OffsetX,0.0+ OffsetY,140.0,140.0),guiSpeedPointer, ScaleMode.StretchToFill,true,0);
	//GUILayout.EndArea();
}
function OnGUI2(){
	/*
	GUI.Label(Rect(10,50,300,100),"Only Test version.")
	if (GUI.Button(rect(10,50,300,100),"Start")){
	Application.LoadLevel(1);
	}
	*/
	GUILayout.BeginArea(Rect((Screen.width/2)-150,(Screen.height/2)-250,300,500));
	//GUILayout.Label("Dies ist ein Test.");

	if (PlayerPrefs.HasKey("Player")){
		playerName = PlayerPrefs.GetString("Player");
		GUILayout.Label("Hello" + playerName);
	}

	playerName = GUILayout.TextField(playerName);
	[COLOR="red"]PlayerPrefs.SetString("Player",playerName);[/COLOR]

	//playerName = PlayerPrefs.GetString("Player");

	if (GUILayout.Button("Start")){
		Application.LoadLevel(2);
	}
	GUILayout.EndArea();
}

Thanks very much!!