Hey So I Have A Problem Idk What Is Wrong With My Code Can Someone Help Me?

public class spaceshipScript : MonoBehaviour
{
var rotationSpeed = 1.0;
var force = 3.0;

private Rigidbody2D targetPosition:Vector3;
private Rigidbody2D velocity = Vector3.zero;

function Update()
{
if (Input.GetMouseButton(0))
{
var pos = Input.mousePosition;
pos.z = Camera.main.transform.position.y;
pos = Camera.main.ScreenToWorldPoint(pos);

var targetRotation = Quaternion.LookRotation(pos - transform.position);
velocity += transform.forward * Time.deltaTime * force;
}
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
transform.position += velocity * Time.deltaTime;
}
#pragma strict

var rotationSpeed = 1.0;
var force = 3.0;

private var targetPosition:Vector3;
private var velocity = Vector3.zero;

function Update()
{
if (Input.GetMouseButton(0))
{
var pos = Input.mousePosition;
pos.z = Camera.main.transform.position.y;
pos = Camera.main.ScreenToWorldPoint(pos);

var targetRotation = Quaternion.LookRotation(pos - transform.position);
transform.rotation = targetRotation;
velocity = Vector3.Project(velocity, transform.forward);
velocity += transform.forward * Time.deltaTime * force;
}
transform.position += velocity * Time.deltaTime;
}

Please put your code inside code tags so we can read it (it’s in the toolbar). Also, you have to say what problem you’re having (as in, what the code is supposed to do, and what it’s doing instead) before we can help.