RigidBody Ignores If Statement

Hi, I’m very new to unity and started programming in javascript.
This is probably a very dumb mistake but what I’m trying to do is to make the rigidbody attached to the cube move along the y axis when I click “W”.Instead when I press Start, It goes up straight away without me clicking “W”
Here is my code:

#pragma strict

var rb: Rigidbody;

function Start () {
rb = GetComponent.();
}

function FixedUpdate () {

if (Input.GetKeyDown(KeyCode.W));{
rb.velocity = Vector3(0,10,0);
}

}
Thank you in advance.

You have an extra semicolon in your if statement:

if (Input.GetKeyDown(KeyCode.W));{

It’s kind of an esoteric issue, but that’s an “empty statement”, which becomes the thing the if statement is actually running or not running. As a result, it means the following code (the velocity change) is essentially on its own line and always being run.