Player movement error

Hi,

I can’t quite say I’m new to unity, I just haven’t scripted much. I’m trying to script a player controller in javascript, and so I’m starting with movement. Here’s part of my code:

if (Input.GetAxis(“W/S”) > 0) // Cheching for the “W” key.
{
transform.Translate.z = transform.Translate.z + playerMovementSpeed;
}

playerMovementSpeed is a float variable currently set at 50 just so you know. When I try to play the game, I get this error:

Object Refference not set to an instance of an object

I can get into play mode without trouble, but when I give it the input, this is what I get. Any Idea what I should do about it?

Thanks,

Also, this is the first thread I’m posting to unity forum, so if this kind of thread doesn’t belong here, but does belong in unity answers, just tell me.

Translate is a function, and you are accessing it as if it is a vector. Look at this for reference for the properties and functions on Transform: Unity - Scripting API: Transform

Okay, I’ve fixed that. Thanks a bunch.