Problem with transform.position

Hello everyone ;)

I have this script:

var Speed        : float = 0;
var MaxSpeed     : float = 10;
var Acceleration : float = 10;
var Deceleration : float = 10;
var rotateSpeed = 25.0;
function Update () 
{
if(Input.GetKey("a"))
{
transform.eulerAngles.y -= rotateSpeed * Time.deltaTime;
}
if(Input.GetKey("d"))
{
transform.eulerAngles.y += rotateSpeed * Time.deltaTime;
}
if ((Input.GetKey ("s"))&&(Speed < MaxSpeed))
{
    Speed = Speed - Acceleration * Time.deltaTime;  
}
else if ((Input.GetKey ("w"))&&(Speed > -MaxSpeed))
{
    Speed = Speed + Acceleration * Time.deltaTime;
}
else
{
    if(Speed > Deceleration * Time.deltaTime)
{
        Speed = Speed - Deceleration * Time.deltaTime;
}
else if(Speed < -Deceleration * Time.deltaTime)
{
        Speed = Speed + Deceleration * Time.deltaTime;
}
else
{
    Speed = 0;
}
}

transform.position.z = transform.position.z + Speed * Time.deltaTime;
}

Simple yet quiet effectivt...

The problem is that I want my character to turn, wich I have done using `transform.eulerAngles`

The problem is that, my character moves along the "World axes" no matter how he turns he will still move in the world z-axes if I press "w" If he faces backwards ind a press w(forward key) he still moves along the world z direction.

So my question is is there a way to get my charcter move along his "Local axes" instead of the "World/global axes"

First: Don't increment or decrement eulerAngles. If they are out of bounds [0..360] you get an error. Use Transform.Rotate instead.

And for the position use localPosition or Translate