Noobish Question Pertaining to JS Movement

Okay, I was messing around with unity, and I’m trying to figure out how to make movements, but when I use this code it says that on 6,66 I need a semicolon, but I already have one there. Advise.

function Update ()
{
	if(Input.GetButtonDown(KeyCode.ForwardW))
	{
		transform.position.z += .25;
		setTimeout(function (){transform.position.y += .1}, 0050);
	}
}

The “setTimeout” line doesn’t use valid syntax; not sure what you’re trying to do there. Also, GetButtonDown takes a string, not a KeyCode (and there is no KeyCode.ForwardW enum). I would encourage you to put “#pragma strict” at the top of your scripts so errors like that will be caught at compile-time instead of run-time.

I think it’s reading the curly braces. JS doesn’t use curly braces in the middle of a line, they are used for delaring a Body of code. Replace them with normal brackets and remove the ones befor the curly braces, then it should work.